I'm not well versed in Webpack, yet, but I'm having some issues getting the plugin to run. After running npm i -D copy-webpack-plugin and setting up the plugin by doing the below, I get some errors. I've doubled checked my spelling and capitalization, but still no luck. As a side note, I don't actually see a copy-webpack-plugin folder in my node_modules also, odd.
var CopyWebpackPlugin = require('copy-webpack-plugin')
and
new CopyWebpackPlugin([
{ from: 'src/robots.txt', to: 'dist/robots.txt' },
{ from: 'src/sitemap.xml', to: 'dist/sitemap.xml' }
], {
copyUnmodified: true
}),
when I run my build script, I get the following error:
module.js:457
throw err;
^
Error: Cannot find module 'copy-webpack-plugin'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/dbeitel/sites/viiv-selzentry-hcp-v2/build/webpack.prod.conf.js:9:25)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/dbeitel/sites/viiv-selzentry-hcp-v2/build/build.js:10:21)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
error Command failed with exit code 1.
Derp, I forgot I shrinkwrapped this project. Problem resolved itself after fixing that.
What is shrinkwrap?
What is shrinkwrap? @DevanB
I got this same issue when i start my angular app using ng serve -o. I have installed copy-webpack-plugin in my local by using npm install --save-dev copy-webpack-plugin. After that issue got resolved.
cd ..
rm -rf 'yourProject'
git clone 'git@xxx'
yarn install
yarn start
OK~
npm sheinkwrap is a command that creates a lock file (what yarn does by default), and won鈥檛 let you add/change/remove dependencies without removing the shrinkwrap. There is no reason to use it if you use Yarn :)
@DevanB thanks
Most helpful comment
What is shrinkwrap?