diff options
| author | mokha <mokha@cisco.com> | 2018-09-29 11:29:16 -0600 |
|---|---|---|
| committer | mokha <mokha@cisco.com> | 2018-09-29 11:29:16 -0600 |
| commit | e9e7a46656da65b582fc44a1108c26fab115c99a (patch) | |
| tree | 784e12705a86b0d43a740aea20687d065bcfb145 /webpack.config.js | |
| parent | 1ecb57bb616870f46c8d46bc192dfd87001ede0a (diff) | |
split into multiple pages.
* https://survivejs.com/webpack/output/multiple-pages/
Diffstat (limited to 'webpack.config.js')
| -rw-r--r-- | webpack.config.js | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/webpack.config.js b/webpack.config.js index 7355b05..813e5bf 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,4 @@ const merge = require('webpack-merge'); -const HtmlWebpackPlugin = require('html-webpack-plugin'); const path = require('path'); const glob = require('glob'); const parts = require('./webpack.parts'); @@ -11,11 +10,9 @@ const PATHS = { const commonConfig = merge([ { - plugins: [ - new HtmlWebpackPlugin({ - title: 'Webpack demo', - }), - ], + output: { + publicPath: "/", + }, }, parts.loadJavaScript({ include: PATHS.app }), parts.setFreeVariable("HELLO", "hello from config"), @@ -88,8 +85,23 @@ const developmentConfig = merge([ module.exports = mode => { process.env.BABEL_ENV = mode; - if (mode === "production") { - return merge(commonConfig, productionConfig, { mode }); - } - return merge(commonConfig, developmentConfig, { mode }); + const pages = [ + parts.page({ + title: "Webpack demo", + entry: { + app: PATHS.app, + }, + chunks: ["app", "manifest", "vendor"], + }), + parts.page({ + title: "Another demo", + path: "another", + entry: { + another: path.join(PATHS.app, "another.js"), + }, + chunks: ["another", "manifest", "vendor"], + }), + ]; + const config = mode === "production" ? productionConfig : developmentConfig; + return merge([commonConfig, config, { mode }].concat(pages)); }; |
