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.

RuntimeTemplate.moduleId(): Module `*.treat.ts` has no id. This should not happen

See original GitHub issue

Hi, I’ve been experiencing really strange errors in webpack builds.

Seems like treat webpack plugin sometimes (?) does not return (?) module ID to webpack upon compilation (if I understand the process correctly).

The exact error during webpack build is

/Users/xxx/projects/yyy/frontm/node_modules/babel-loader/lib/index.js??ref--7-oneOf-2!/Users/xxx/projects/yyy/front/SomeComponent.tsx
RuntimeTemplate.moduleId(): Module /Users/xxx/projects/yyy/frontm/node_modules/treat/webpack-plugin/loader.js??ref--4-0!/Users/xxx/projects/yyy/frontm/node_modules/babel-loader/lib/index.js??ref--7-oneOf-2!/Users/xxx/projects/yyy/front/SomeComponent.treat.ts has no id. This should not happen.

Also there is another way of failing: webpack build succeeds but there are some __webpack_require__(null) and this is null is that missing ID (as there are pre-terser comments and it’s that exact module). And in this case I get a runtime error.

But I believe this is basically the same problem.

Unfortunately, I can’t create a small reproducible repo as both these errors seem to vanish when I delete some other code and barebones example has no problems. I’ll try to accomplish this but can’t guarantee.

The most important thing: the very same code outputs different results. So sometimes I get __webpack_require__(null) instead of treat import, rerun the build without changing anything and got correct module id like __webpack_require__(53).

Seems like some race condition.

It also should be noted that this treat module I’m talking about is imported into more than 1 React component. I understand it’s not the best way to deal with CSS and goes against CSS best practices but I believe that should work ok in terms of compilation.

While I’m trying to come up with a reproducible repo, could you please guide me into the direction where this error might originate from?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
mattcompilescommented, Feb 18, 2020

Thanks for this bud. Will take a look.

0reactions
kompotcommented, Apr 10, 2020

Also seems to be fixed in webpack 5 beta/master https://github.com/webpack/webpack/issues/10409

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 6 | Webpack Production Build Error - Stack Overflow
For some reason it is only working (in my case) if I changed one line of code in the rxjs module (file node_modules/rxjs/package.json...
Read more >
Ahead-of-time (AOT) compilation - Angular
The AOT compiler detects and reports template binding errors during the build step before users can see them. Better security, AOT compiles HTML...
Read more >
https://unpkg.com/webpack@5.27.1/types.d.ts
singleton?: boolean; /** * Do not accept shared module if version is not valid ... Treat NW.js legacy nw.gui module as external and...
Read more >
webpack-name-moduleid-plugin - npm
Webpack is assigning module name with a random int number. Every time webpack compiles, this module name could change.
Read more >
Webpack 5 release (2020-10-10)
MIGRATION: Make sure that your webpack 4 build does not print ... A Module ID is determined by its path, relative to the...
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