I am currently exploring the new version of vuejs/vue-cli ( beta 3.0 ) that promises to simplify webpack configuration significantly. However, there are limited examples available at this time...
As part of my testing, I attempted to transition from vue-cli v2
webpack.dev.conf.js
plugins: [
//...
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
]) ]
to the latest vue-cli version 3 (beta)
vue.config.js
const path = require('path')
module.exports = {
chainWebpack: config => {
config
.plugin('copy')
.use(require('copy-webpack-plugin')), [{
from: path.resolve(__dirname, '../static'),
to: 'static', ignore: ['.*']
}]
}
}
When I run
npm run serve
no errors are reported...
which seems to indicate that everything is working fine. Nevertheless, I would appreciate any resources such as tutorials, documentation or existing code examples related to this topic. At the moment, I am only able to learn about new features by studying code snippets.
My current challenge involves converting this piece of code:
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
I attempted to modify it using:
config
.plugin('provide')
.use(require('webpack.ProvidePlugin')), [{
$: 'jquery',
jquery: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}]
but encountered an error:
INFO Starting development server...
ERROR Error: Cannot find module 'webpack.ProvidePlugin'
Error: Cannot find module 'webpack.ProvidePlugin'
at Function.Module._resolveFilename (module.js:536:15)