/
webpack.config.js
52 lines (47 loc) · 1.79 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
/**
* @see http://webpack.github.io/docs/configuration.html
* for webpack configuration options
*/
module.exports = {
// 'context' sets the directory where webpack looks for module files you list in
// your 'require' statements
context: __dirname + '/app/assets/javascripts',
// 'entry' specifies the entry point, where webpack starts reading all
// dependencies listed and bundling them into the output file.
// The entrypoint can be anywhere and named anything - here we are calling it
// '_application' and storing it in the 'javascripts' directory to follow
// Rails conventions.
entry: './_application.js',
// 'output' specifies the filepath for saving the bundled output generated by
// wepback.
// It is an object with options, and you can interpolate the name of the entry
// file using '[name]' in the filename.
// You will want to add the bundled filename to your '.gitignore'.
output: {
filename: '[name].bundle.js',
// We want to save the bundle in the same directory as the other JS.
path: __dirname + '/app/assets/javascripts',
},
externals: {
// If you load jQuery through a CDN this will still work
// jQuery is now available via "require('jquery')"
jquery: 'var jQuery'
},
// Turns on source maps
// Prefix with a '#' to squash the FF warnings that say:
// 'Using //@ to indicate sourceMappingURL pragmas is deprecated.
// Use //# instead'
devtool: '#eval-source-map',
// The 'module' and 'loaders' options tell webpack to use loaders.
// @see http://webpack.github.io/docs/using-loaders.html
module: {
loaders: [
{
// @see https://github.com/shama/es6-loader
// It was installed with 'npm install es6-loader --save' and transpiles
// es6 to es5.
loader: 'es6-loader'
}
]
}
};