aboutsummaryrefslogtreecommitdiff
path: root/node_modules/vuepress/lib/webpack/createClientConfig.js
diff options
context:
space:
mode:
authorruki <waruqi@gmail.com>2018-11-08 00:38:48 +0800
committerruki <waruqi@gmail.com>2018-11-07 21:53:09 +0800
commit26105034da4fcce7ac883c899d781f016559310d (patch)
treec459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/vuepress/lib/webpack/createClientConfig.js
parent2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff)
downloadxmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz
xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip
switch to vuepress
Diffstat (limited to 'node_modules/vuepress/lib/webpack/createClientConfig.js')
-rw-r--r--node_modules/vuepress/lib/webpack/createClientConfig.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/node_modules/vuepress/lib/webpack/createClientConfig.js b/node_modules/vuepress/lib/webpack/createClientConfig.js
new file mode 100644
index 00000000..8c276633
--- /dev/null
+++ b/node_modules/vuepress/lib/webpack/createClientConfig.js
@@ -0,0 +1,69 @@
+module.exports = function createClientConfig (options, cliOptions) {
+ const path = require('path')
+ const WebpackBar = require('webpackbar')
+ const createBaseConfig = require('./createBaseConfig')
+
+ const config = createBaseConfig(options, cliOptions)
+
+ config
+ .entry('app')
+ .add(path.resolve(__dirname, '../app/clientEntry.js'))
+
+ config.node
+ .merge({
+ // prevent webpack from injecting useless setImmediate polyfill because Vue
+ // source contains it (although only uses it if it's native).
+ setImmediate: false,
+ global: false,
+ process: false,
+ // prevent webpack from injecting mocks to Node native modules
+ // that does not make sense for the client
+ dgram: 'empty',
+ fs: 'empty',
+ net: 'empty',
+ tls: 'empty',
+ child_process: 'empty'
+ })
+
+ // generate client manifest only during build
+ if (process.env.NODE_ENV === 'production') {
+ // This is a temp build of vue-server-renderer/client-plugin.
+ // TODO Switch back to original after problems are resolved.
+ // Fixes two things:
+ // 1. Include CSS in preload files
+ // 2. filter out useless styles.xxxxx.js chunk from mini-css-extract-plugin
+ // https://github.com/webpack-contrib/mini-css-extract-plugin/issues/85
+ config
+ .plugin('ssr-client')
+ .use(require('./ClientPlugin'), [{
+ filename: 'manifest/client.json'
+ }])
+
+ config
+ .plugin('optimize-css')
+ .use(require('optimize-css-assets-webpack-plugin'), [{
+ canPrint: false,
+ cssProcessorOptions: {
+ safe: true,
+ autoprefixer: { disable: true },
+ mergeLonghand: false
+ }
+ }])
+ }
+
+ if (!cliOptions.debug) {
+ config
+ .plugin('bar')
+ .use(WebpackBar, [{
+ name: 'Client',
+ color: '#41b883',
+ compiledIn: false
+ }])
+ }
+
+ if (options.siteConfig.chainWebpack) {
+ options.siteConfig.chainWebpack(config, false /* isServer */)
+ }
+
+ return config
+}