-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
51 lines (43 loc) · 1.57 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
// Webpack configuration for the Patternslib bundle distribution.
process.traceDeprecation = true;
const CopyPlugin = require("copy-webpack-plugin");
const mf_config = require("@patternslib/dev/webpack/webpack.mf");
const package_json = require("./package.json");
const path = require("path");
const patternslib_config = require("@patternslib/dev/webpack/webpack.config");
module.exports = (env, argv) => {
let config = {
entry: {
"bundle.min": path.resolve(__dirname, "src/index.js"),
"bundle-polyfills.min": path.resolve(__dirname, "node_modules/@patternslib/patternslib/src/polyfills.js"), // prettier-ignore
},
};
config = patternslib_config(env, argv, config);
config.output.path = path.resolve(__dirname, "dist/");
// Modernizr
config.module.rules.push({
test: /\.modernizrrc\.js$/,
loader: "webpack-modernizr-loader",
});
config.resolve.alias = {
modernizr$: path.resolve(__dirname, ".modernizrrc.js"),
};
config.plugins.push(
mf_config({
name: "patternslib",
remote_entry: config.entry["bundle.min"],
dependencies: package_json.dependencies,
})
);
// Polyfills
config.plugins.push(
// Copy polyfills loader to the output path.
new CopyPlugin({
patterns: [
{ from: path.resolve(__dirname, "node_modules/@patternslib/patternslib/src/polyfills-loader.js"), }, // prettier-ignore
],
})
);
//console.log(JSON.stringify(config, null, 4));
return config;
};