-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.babel.js
67 lines (61 loc) · 1.51 KB
/
webpack.config.babel.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
import webpack from 'webpack';
import WebpackNotifierPlugin from 'webpack-notifier';
import path from 'path';
const COMPONENTS_PATH = path.join(__dirname, 'app/assets/javascripts/app');
// app entry file (used for webpack only)
const APP_ENTRY_FILE = './global.js';
// bundle path (JavaScripts root)
const OUTPUT_PATH = path.join(__dirname, 'app/assets/javascripts/');
// bundle (rails assets file)
const OUTPUT_FILE = 'bundle.js';
const env = process.env.NODE_ENV || 'development';
// const autoprefixer = require('autoprefixer');
const ProvidePlugin = require('webpack/lib/ProvidePlugin');
// postcss: [autoprefixer]; // this is inside module.exports object
export default {
context: COMPONENTS_PATH,
entry: {
app: [APP_ENTRY_FILE]
},
output: {
path: OUTPUT_PATH,
filename: OUTPUT_FILE
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.js?$/, // Match both .js and .jsx files
exclude: /node_modules/,
loader: "babel",
}
],
rules: [{
test: /\.jsx?$/, // Match both .js and .jsx files
exclude: /node_modules/,
use: ['babel-loader']
},
]
},
resolve: {
extensions: [
'.jsx',
'.js'
],
modules: [
COMPONENTS_PATH,
"node_modules"
]
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(env)
}
}),
new WebpackNotifierPlugin(),
new webpack.ProvidePlugin({
}),
]
};