$ preact -v
1.3.0
$ npm -v
5.2.0
Error:
Error: Cannot find module 'extract-text-webpack-plugin'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/khoa/web/mui/node_modules/preact-cli/lib/lib/webpack/webpack-base-config.js:13:33)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/khoa/web/mui/node_modules/preact-cli/lib/lib/webpack/webpack-client-config.js:39:26)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/khoa/web/mui/node_modules/preact-cli/lib/lib/webpack/run-webpack.js:27:28)
at Module._compile (module.js:569:30)
Reproduce:
preact create test && cd $_npm startP/s:
This only happens with [email protected]. For some reason, node can't resolve it
โฏ npm ls extract-text-webpack-plugin
[email protected] /home/khoa/web/mui
โโโฌ [email protected]
โโโฌ @webpack-blocks/[email protected]
โโโ [email protected]
My rule of thumb is if you use it, you must install it first. Thoughts @developit @lukeed ?
@thangngoc89 can't able to reproduce.
Might be because during installation of node_modules, something got missed.
Can you try removing node_modules and reinstalling them?
@reznord I reproduced this twice.
Apparently, npm installed it but node can't resolve it
โฏ npm ls extract-text-webpack-plugin
[email protected] /home/khoa/web/mui
โโโฌ [email protected]
โโโฌ @webpack-blocks/[email protected]
โโโ [email protected]
And yes, I removed node_moduels and re-install it twice
Looks like an npm issue for me. In 5.0.1, I am not able to reproduce this.
Same issue if you try to use npx to create a new app:
$ npx preact-cli create test
npx: installed 1 in 12.986s
Cannot find module 'extract-text-webpack-plugin'
Which otherwise would be an awesome way to use preact-cli.
@slaskis Actually it's how I discovered this bug. :D . Wanted to try out npx on [email protected]
sounds like an npm dedupe issue
@developit My point still stand. We are importing extract-text-webpack-plugin directly in the code, so we should install directly
I agree with @thangngoc89. Webpack 3 has separated the plugin totally. I guess it is better to install it separately.
@reznord Could you make a PR to replace @webpack-blocks/extract-text2 with extra-text-webpack-plugin directly? We dont use @webpack-blocks/extract-text2 directly anymore.
@thangngoc89 ayeee... PR enroute. ๐
@thangngoc89 we are not using that anywhere as of now.
Edit: Oops, didn't see that. Got it. Gonna push it soon.
@reznord I'm not follow. We're using extract-text-webpack-plugin but not webpack-block/extract-text2.
Got this error using the latest NPM, was able to "fix" by simply using yarn instead.
For anyone stuck: yarn global add preact-cli
Then yarn and yarn start in the created project.
^^ Ahh interesting, I didn't realize we had moved off of webpack-blocks for this already. Definitely best to add it as a dependency then.
We also got to the same problem. The current issue rises when we don't install preact-cli globally and use it from the node_modules.
@reznord any pr for the master branch? It has been fixed in the webpack3 branch 79fb4fa9cb89e3ce1f189d38feaf6a235f30f66f
@anantoghosh webpack3 will be available in the next version (which might take sometime) because there are a bunch of things which we are planning for the next release
@anantoghosh if you can send a PR to back port that change to preact-cli, I'll be happy to merge it
I wouldn't do that! Since it is already changed in webpack branch, that might just lead us to conflicts while merging it.
@reznord this is a bug and we should fix it asap. Since webpack 3 will be a major change and the release day is pretty much unclear. I would recommend back port the fix and release a new version
Well, in that case it is fine. (:
Most helpful comment
Got this error using the latest NPM, was able to "fix" by simply using yarn instead.
For anyone stuck:
yarn global add preact-cliThen
yarnandyarn startin the created project.