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.

TypeError: The 'compilation' argument must be an instance of Compilation

See original GitHub issue

Bug description

Build is failed when using next-css plugin

Reproduction steps

  1. Add @zeit/next-css plugin to next.config.js
  2. import a css file in tsx component
  3. build

esbuild-loader will fail during build with TypeError: The 'compilation' argument must be an instance of Compilation

Environment

  • esbuild-loader version: 2.9.2
  • Webpack version: 5.24.2
  • Operating System: macOS 10.15.7
  • Node version: 14.4.0
  • Package manager (npm/yarn/pnpm) and version: yarn 1.22.0

More info

Build is successful if next-css plugin is removed and also it works well with next-images plugin.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
privatenumbercommented, Mar 15, 2021

You’re getting the type error because esbuild-loader currently uses Webpack 4 types. I’m interested in supporting both Webpack 4 and 5 types in the future. It’s a known issue but I’ll leave this open till it’s addressed.

RE: is there some way to achieve more speed? esbuild touts 100x Running esbuild as a bundler vs esbuild-loader + Webpack are completely different. esbuild is highly optimized and is purely in Golang; you’ll get 100x if you let it handle your entire build. esbuild-loader is handled by Webpack (in JS runtime) and transforms are applied per-file so there’s a relatively large bottleneck that makes reaching those speeds impossible. It’s just that babel-loader/ts-loader/Terser are so much slower so esbuild-loader can offer pretty big speed gains by removing the bottleneck there.

RE: Do you plan for type-checking support? esbuild-loader is more or less just a Webpack wrapper for esbuild, so you’ll want to direct your question at esbuild instead. Looks like it’s already answered here but if you have a compelling case you can always open a feature request.

1reaction
privatenumbercommented, Apr 21, 2021

Keeping this open as I’d still like to resolve the Wepback 5 types issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

The 'compilation' argument must be an instance of Compilation
The command I'm running is ng build . My angular.json is as follows: { "$schema": "./node_modules/@angular/cli/ ...
Read more >
Webpack 5: The 'compilation' argument must be an ... - GitHub
TypeError: The 'compilation ' argument must be an instance of Compilation - JavascriptModulesPlugin.js:116 Function.
Read more >
[webpack-cli] TypeError: The 'compilation' argument must be ...
When i run npm run dev i get this error: Copy Code [webpack-cli] TypeError: The 'compilation' argument must be an instance of Compilation....
Read more >
build-storybook error: The 'compilation' argument must be an ...
TypeError: The 'compilation ' argument must be an instance of Compilation. To Reproduce I'm trying to run npm run build-storybook and getting the...
Read more >
Fixing the "'compilation' argument must be an instance of ...
Fixing the "'compilation' argument must be an instance of Compilation" Duplicate Webpack Version Error ... The fix is simply to get all of...
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