Last active
March 3, 2019 20:04
-
-
Save LinusBorg/c6fb4235704fde98fe182a12dcce3ba0 to your computer and use it in GitHub Desktop.
Adding a local plugin to a Vue CLI preset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Local Plugin: | |
// https://cli.vuejs.org/guide/plugins-and-presets.html#project-local-plugin | |
// See also: | |
// https://cli.vuejs.org/dev-guide/plugin-dev.html#modifying-webpack-config | |
module.exports = api => { | |
const webpack = require('webpack') | |
api.configureWebpack({ | |
plugins: [ | |
new webpack.optimize.LimitChunkCountPlugin({ | |
maxChunks: 1 | |
}) | |
] | |
}) | |
api.chainWebpack(config => { | |
config.optimization.delete('splitChunks') | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = api => { | |
// https://cli.vuejs.org/dev-guide/plugin-dev.html#creating-new-templates | |
api.render('./chunksPlugin.js') | |
// We need to make cli aware of the local plugin by adding it to package.json | |
// https://cli.vuejs.org/dev-guide/plugin-dev.html#extending-package | |
api.extendPackage({ | |
vuePlugins: { | |
service: ['chunksPlugin.js'] | |
} | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"useConfigFiles": true, | |
"router": true, | |
"plugins": { | |
"@vue/cli-plugin-babel": {}, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment