RuntimeTemplate.moduleId(): Module `*.treat.ts` has no id. This should not happen
See original GitHub issueHi, 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:
- Created 4 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top GitHub Comments
Thanks for this bud. Will take a look.
Also seems to be fixed in webpack 5 beta/master https://github.com/webpack/webpack/issues/10409