-
Notifications
You must be signed in to change notification settings - Fork 0
/
.webpackrc.js
executable file
·50 lines (47 loc) · 1.38 KB
/
.webpackrc.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
// Learn more about configuring Webpack
// https://webpack.js.org/concepts/
import webpack from "webpack"
export default function(env) {
const isProduction = (env === "production") || (process.env.NODE_ENV === "production")
return {
output: {
path: __dirname + "/js/",
filename: "[name].js"
},
externals: {
// Any third-party deps added via a <script> tag
// can be defined here so that they can be required
// in your application's JS files
// "jquery": "jQuery"
},
resolve: {
// Can be used to create aliases for imports
// utilities: path.resolve(__dirname, 'src/js/example/utilities/')
// => import * from "utilities/filename"
},
module: {
rules: [
{
// Enables ES6 syntax for JS
loader: "babel-loader",
test: /\.js?$/,
exclude: /node_modules/,
query: {cacheDirectory: true}
}
]
},
devtool: (isProduction) ? "nosources-source-map" : "cheap-eval-source-map",
plugins: [
new webpack.ProvidePlugin({
// Automatically make packages available
// without having to require them
// $: "jquery",
// jQuery: "jquery",
fetch: "imports-loader?this=>global!exports?global.fetch!whatwg-fetch"
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true
})
]
}
}