core-js dependency
Hi, thanks for rollpkg, I started to use it on a few projects and it feels great!
I just wanted to open this issue to track one I was having with the csso-webpack-plugin dependency (via package-build-stats): https://github.com/zoobestik/csso-webpack-plugin/issues/28
The temporary fix is to have core-js as a devDependency in my library. Until csso-webpack-plugin and package-build-stats receive publish a new version, maybe core-js could be added as dependency in rollpkg?
I'm not sure I understand the what the issue is? Is it possible to reproduce? Thanks.
Sorry, this is the error I was getting on build:
$ yarn build
internal/modules/cjs/loader.js:1088
throw err;
^
Error: Cannot find module 'core-js/modules/es.string.replace.js'
Require stack:
- /home/pierre/s/use-nft/node_modules/csso-webpack-plugin/lib/index.js
- /home/pierre/s/use-nft/node_modules/package-build-stats/build/config/makeWebpackConfig.js
- /home/pierre/s/use-nft/node_modules/package-build-stats/build/utils/build.utils.js
- /home/pierre/s/use-nft/node_modules/package-build-stats/build/getPackageStats.js
- /home/pierre/s/use-nft/node_modules/package-build-stats/build/index.js
- /home/pierre/s/use-nft/node_modules/rollpkg/dist/bundlephobiaStats.js
- /home/pierre/s/use-nft/node_modules/rollpkg/dist/cli.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1085:15)
at Function.Module._load (internal/modules/cjs/loader.js:928:27)
at Module.require (internal/modules/cjs/loader.js:1145:19)
at require (internal/modules/cjs/helpers.js:75:18)
at Object.<anonymous> (/home/pierre/s/use-nft/node_modules/csso-webpack-plugin/lib/index.js:6:1)
at Module._compile (internal/modules/cjs/loader.js:1256:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
at Module.load (internal/modules/cjs/loader.js:1105:32)
at Function.Module._load (internal/modules/cjs/loader.js:967:14)
at Module.require (internal/modules/cjs/loader.js:1145:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/pierre/s/use-nft/node_modules/csso-webpack-plugin/lib/index.js',
'/home/pierre/s/use-nft/node_modules/package-build-stats/build/config/makeWebpackConfig.js',
'/home/pierre/s/use-nft/node_modules/package-build-stats/build/utils/build.utils.js',
'/home/pierre/s/use-nft/node_modules/package-build-stats/build/getPackageStats.js',
'/home/pierre/s/use-nft/node_modules/package-build-stats/build/index.js',
'/home/pierre/s/use-nft/node_modules/rollpkg/dist/bundlephobiaStats.js',
'/home/pierre/s/use-nft/node_modules/rollpkg/dist/cli.js'
]
}
I added core-js as dependency as a temporary fix. Please install rollpkg v0.5.4. I'm going to leave this issue open as a reminder to remove core-js when this is fixed upstream.
Oh that’s great, thank you!
Yeah I hadn't seen the error before and wasn't able to reproduce it until I regenerated rollpkg-example-package's lock file. But seeing as it would affect every fresh install of rollpkg, a fix was required.
Interestingly, I noticed this issue by migrating a new project to rollpkg, while use-nft was working well. Then at some point, I started to have the issue on use-nft as well − probably after I deleted the lockfile.
So I suspect core-js was the dependency of another module before (maybe not even related to rollpkg, it could be eslint, prettier or something else every project uses), and a minor upgrade in that module removed it, breaking the implicit dependency in csso-webpack-plugin.
Fixed in [email protected]