Target es6 for esm build
See original GitHub issueDescription of the bug
Previously, I could use postprocessing in my webpack bundling without any additional processing (e.g. babel). Recently, however, it appears the language target has moved to “esnext” which includes language features such as “??” and “?.” which are less compatible. Specifically, the build/postprocessing.esm.js
generated file includes these esnext features.
To Reproduce
Run pnpm build
and inspect the build/postprocessing.esm.js
file to see that it includes ??
and ?.
operators.
Expected behavior
Produce a plain “es6” target.
Library versions used
- Three: n/a
- Post Processing: main
Potential Solution
The https://github.com/pmndrs/postprocessing/blob/main/esbuild.mjs#L69 instructions do not include target: "es6"
, but I believe adding this would solve the issue.
Issue Analytics
- State:
- Created a year ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to transpile ES modules with webpack and Node.js
Learn how webpack interacts with and supports ES modules in this deep dive tutorial on transpilation in Node.js.
Read more >How to Create a Hybrid NPM Module for ESM and CommonJS.
Author your code in ES6, ES-Next or Typescript using import and export. From this base, you can import either ES modules or CommonJS...
Read more >Create ES6 module 'equivalent' using webpack output.target ...
The problem. Suppose I have two ES6 files that expose default functions // file_1.js export default function(){ ...
Read more >Documentation - ECMAScript Modules in Node.js - TypeScript
For the last few years, Node.js has been working to support running ECMAScript modules (ESM). This has been a very difficult feature to...
Read more >TypeScript and native ESM on Node.js - 2ality
The GitHub repository iterable is an example of a TypeScript ESM package that works on ... "ES6" , "ES2015" : support for basic...
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
Thanks for the repro 👍
I did some research and found that support for ?? and ?. was added to
acorn
in version 7. Webpack 4, however, is locked to version 6 and hence doesn’t support this syntax.You should upgrade to
webpack
5 if possible. I’ll set the build target toes2019
which will transpile the??
and?.
syntax to ease the transition. but this will be reverted in the next major release.Thanks! I had forgotten that Webpack is dependent on
acorn
. That was the piece I was missing in being able to explain to myself what was going on.I believe our project can be updated to Webpack 5, but it will be a few months, so a little more time would be greatly appreciated.