i\'m trying to preview a vue web application through webpack-server-dev.I\'m following this guide https://medium.com/the-web-tub/creating-your-first-vue-js-pwa-project-22f7
I am not very much familiar with webpack and currently learning it
although this thing below helped me fix the issue
I just uninstall clean-webpack-plugin and then reinstall as dependency before this i've intalled as a dev-dependency
after uninstall and installing it like that : npm install --save clean-webpack-plugin
and by adding this
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
solved my issue!!
hope it helps
I had the same issue today, right now. As you can tell, there was a mismatch between the docs and the actual code. And in fact, you can see in the last commit they merged both to the documentation:
and also to the code:
So I just switched from const CleanWebpackPlugin = require('clean-webpack-plugin')
to
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
and it works fine.
I think you may have been caught in between things. Reinstall the npm package and try again, it should work.
I wrote a bit of what you can see in their public repository because very often when sudden changes like this happen, you'll find your own answer in the repo, probably in the last commits. And it's good reading a bit of the code you use, especially if it helps you troubleshoot your issue :)
Looks like docs are broken, correct code is
const CleanWebpackPlugin = require('clean-webpack-plugin')
With the update you'll need to do the following to include it
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
Then in the array of plugins replace add the following
plugins: [
new CleanWebpackPlugin(['dist]),
]
with
plugins: [
new CleanWebpackPlugin(),
]
As the with the update there is no need to pass any parameters as it will remove all files inside webpack's output.path
directory, as well as all unused webpack assets after every successful rebuild.