-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
42 lines (41 loc) · 1.13 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
require('dotenv').config();
var path = require('path');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var webpack = require('webpack')
module.exports = {
entry: ['babel-polyfill', './src/index.js'],
output: {
filename: 'codesplain.js',
path: __dirname + '/build'
},
module: {
rules: [
{
enforce: "pre",
test: /\.js$/,
exclude: /node_modules/,
loader: "eslint-loader",
options: {useEslintrc: false, baseConfig: { extends: ['react-app']}}
},
{ test: /\.(js|jsx)$/, exclude: /node_modules/, loader: "babel-loader" },
{ test: /\.css$/, use: ExtractTextPlugin.extract({
use: 'css-loader'
})
}]
},
devServer: {
contentBase: [path.join(__dirname, "public"), path.join(__dirname, "build")]
},
plugins: [
new webpack.EnvironmentPlugin(['API_URL', 'NODE_ENV']),
new ExtractTextPlugin('codesplain.css'),
],
resolve: {
extensions: ['.js', '.jsx']
}
}
if (process.env.NODE_ENV === 'production') {
module.exports.plugins.push(
new webpack.optimize.UglifyJsPlugin({minimize: true}) // call the uglify plugin
);
}