esbuild-loader
esbuild-loader copied to clipboard
adapt webpack 1.x or 2.x?
in my old project , using webpack 1.x. And I use esbuild-loader replace babel-loader will print error
` building for production.../Users/wanglihui/WebstoreProject/onionfph5/project/node_modules/esbuild-loader/dist/plugin.js:12 compiler.hooks.thisCompilation.tap('esbuild', compilation => { ^
TypeError: Cannot read property 'thisCompilation' of undefined
at ESBuildPlugin.apply (/Users/wanglihui/WebstoreProject/onionfph5/project/node_modules/esbuild-loader/dist/plugin.js:12:24)
at Compiler.apply (/Users/wanglihui/WebstoreProject/onionfph5/project/node_modules/tapable/lib/Tapable.js:164:16)
at WebpackOptionsApply.process (/Users/wanglihui/WebstoreProject/onionfph5/project/node_modules/webpack/lib/WebpackOptionsApply.js:62:18)
at webpack (/Users/wanglihui/WebstoreProject/onionfph5/project/node_modules/webpack/lib/webpack.js:22:48)
at /Users/wanglihui/WebstoreProject/onionfph5/project/build/build.js:52:3
at Array.map (
The supported Webpack versions are currently ^4.40.0 || ^5.0.0
.
I don't plan on supporting it but I'm open to accepting PRs if support can be added un-intrusively.
thanks your answer
Is it even desired @privatenumber ? At this point webpack 2 is over 4 years old with no updates ever since, webpack has changed fundamentally since then, OP should really update his stack as it is awfully outdated and likely has security holes :(
I agree @wanglihui should update Webpack :)
The problem above was happening due to the ESBuildPlugin, but since the new esbuild-loader has removed it, you might be able to use esbuild-loader
with Webpack v1 now if the loader API hasn't changed. The minification plugin won't work though.
Again, I don't plan on supporting it so I won't be adding tests to guarantee the behavior.
The supported Webpack versions are currently
^4.40.0 || ^5.0.0
.I don't plan on supporting it but I'm open to accepting PRs if support can be added un-intrusively.
I think to avoid this issue in the future, i think we should mention what version of webpack that we use. If it's ok, i can make a PR for it. I'm planning to add it in F.A.Q section. What do you think?
Webpack loaders + plugins declare the version of Webpack they support as a peer dependency, like this: https://github.com/privatenumber/esbuild-loader/blob/be292fa98478590ad71ca01194866f720d3cf648/package.json#L40
That way, npm will warn during installation on unmet peer dependencies.
Closing as Webpack 1 or 2 will not be supported