This repository has been archived by the owner on Mar 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
90 lines (85 loc) · 2.09 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
var autoprefixer = require('autoprefixer');
var precss = require('precss');
var lost = require('lost');
var webpack = require('webpack');
var postcssimport = require('postcss-import');
var inlinesvg = require('postcss-inline-svg');
if(process.env.NODE_ENV!="production"){
require('dotenv').config();
}
var production = "production" === process.env.NODE_ENV;
var entry = ['./src/frontend/index'];
if (!production) {
entry = [
'webpack-dev-server/client?http://0.0.0.0:3000',
'webpack/hot/dev-server'
].concat(entry);
}
module.exports = {
entry: entry,
devtool: 'source-map',
output: {
path: __dirname + '/public/build',
publicPath: 'build/',
filename:"bundle.js"
},
module: {
loaders: [
{
test: /(\.jsx|\.js)$/,
loader: "babel!eslint",
exclude: /(node_modules|bower_components)/
},
{
test: /\.css$/,
loader: 'style!css!postcss'
}
]
// Shut off warnings about using pre-built javascript files
// as Quill.js unfortunately ships one as its `main`.
// noParse: /node_modules\/quill\/dist/quill.
},
eslint: {
configFile: '.eslintrc'
},
postcss: function(webpack) {
return [
postcssimport({addDependencyTo: webpack}),
precss,
inlinesvg,
autoprefixer,
lost
];
},
resolve: {
extensions: ['', '.js', '.jsx']
},
devServer: {
contentBase: './public',
publicPath: '/build',
hot:true,
stats: {
colors: true,
chunks: false
},
proxy: {
'*': {
target: 'http://localhost:3001',
secure: false,
},
},
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.DefinePlugin({
__DEV__: !production,
'process.env.NODE_ENV': '"' + process.env.NODE_ENV + '"',
'GOOGLECALENDAR_ID': '"' + process.env.GOOGLECALENDAR_ID + '"'
})
]
};