question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

adapt webpack 1.x or 2.x?

See original GitHub issue

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 (<anonymous>) at Object.<anonymous> (/Users/wanglihui/WebstoreProject/onionfph5/project/build/build.js:51:14) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:1158:10) at Module.load (internal/modules/cjs/loader.js:986:32)`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:10
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
privatenumbercommented, Apr 27, 2021

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.

1reaction
privatenumbercommented, Feb 7, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating from Webpack 1.x to 2.x - Stack Overflow
In Webpack 2.x, the new way to go is using System.import . While I love receiving a Promise object now, I have two...
Read more >
Getting Started - webpack
Webpack is used to compile JavaScript modules. Once installed, you can interact with webpack either from its CLI or API.
Read more >
Webpack HMR Tutorial - JavaScript Stuff
Below is a separate 'Configuring X' section for each of the 3 ... Change #2: Adjust your webpack.config.js to look similar to this....
Read more >
How to use webpack with Rails - clarkdave.net
So if you specify jQuery version 1.x but another of your dependencies specifies a minimum of jQuery 2.x, you'll need to resolve this ......
Read more >
Using with webpack - Jest
You can adjust the regular expression to match the file types your webpack config handles. tip. Remember to include the default babel-jest ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found