Using imported values inside the create method breaks the Webpack build
See original GitHub issueUsing imported values within the styles object passed to Style9.create()
seems to break the Webpack build when using the Style9 Webpack loader.
Steps to reproduce:
- Clone this minimal reproduction repo I created: https://github.com/nonAlgebraic/style9-import-bug
- Run
yarn install
- Run
yarn build
Expected result
The color value imported from colorValue.js
(“blue
”) is applied to the <body>
.
Actual result
The Webpack build fails with an error:
SyntaxError: unknown: Could not evaluate value
4 | const styles = style9.create({
5 | body: {
> 6 | color: colorValue,
| ^^^^^^^^^^
7 | },
8 | });
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Code Splitting - webpack
The reason we need default is that since webpack 4, when importing a CommonJS module, the import will no longer resolve to the...
Read more >Webpack and Dynamic Imports: Doing it Right
The problem is if you want to dynamically load a file, in this case, an image, Webpack by default generate a chunk for...
Read more >How I solved and debugged my Webpack issue through ...
js ) and one of the source files contains an error, the stack trace will simply point to bundle.js . This isn't always...
Read more >An in-depth perspective on webpack's bundling process
Conceptually, a module in webpack is associated with a file. So, in the diagram 'a.js' will result in a new module and so...
Read more >Error: Cannot find module with dynamic import · Issue #6680
Webpack performs a static analyse at build time. It doesn't try to infer variables which that import(test) could be anything, hence the failure....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Style values are evaluated using babel’s
path.evaluate()
, which operates on a single file. In the future this may be expanded, but at the moment this is per design.@rodrigojcmello could u merge style9’s updates and publish a version?