estrella doesn't seem to be working within ESM context
See original GitHub issueAs more and more dependencies are updating to ESM, I’ve figured it’s time to bite the bullet and make my project ESM-ready as well.
But adding "type": "module"
to my project’s package.json leads to these two issues when running node build.js
:
-
import {build, cliopts} from "estrella"; ^^^^^ SyntaxError: Named export 'build' not found. The requested module 'estrella' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using: import pkg from 'estrella'; const {build, cliopts} = pkg;
the proposed workaround works though.
-
TypeError: Cannot read properties of undefined (reading 'filename')
this is due to this code:https://github.com/rsms/estrella/blob/e5b985bd3292ddaa87022b97062be2f18b15b182/src/util.js#L27
process.mainModule
does not seem to exist in ESM.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
Modify Eleventy to work with ECMAScript Modules (ESM) by ...
Node accept the query params on files but doesn't reimport. I think it's bug again. So you can still copy files and rename...
Read more >Meta: Native support for ES Modules - Rysolv
Since the module scope is gone in ESM, we need to move it somewhere. Adding it to import.meta seems natural - there's an...
Read more >Comparing the New Generation of Build Tools - CSS-Tricks
Code splitting appears to be a work in progress, but is mostly there in the ESM output format, and it does look like...
Read more >Collecting Repeated Data Over Time: Applying Experience ...
ESM involves collecting data in the context of the natural work environment and includes a procedure in which individuals complete a survey ...
Read more >Recent Evolutions in the Economic and Monetary Union and ...
economic policies was introduced, a European Stability Mechanism (ESM) ... in a context in which it is unlikely that all non-euro area Member...
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
I proposed a fix via #53. it works locally for me and all tests pass.
I’m experiencing the second issue (
TypeError: Cannot read properties of undefined (reading 'filename')
) as well on a project that worked fine with v1.3.x.I need 1.4.x because I’m building a browser JS bundle and without the
sourcesContent
option, my sourcemaps are broken.(@ptim ironically, I was using the same template for my use case)