tc39 / proposal-temporal

Provides standard objects and functions for working with dates and times.
https://tc39.es/proposal-temporal/docs/
Other
3.3k stars 149 forks source link

Using the polyfill buildless with ES6 modules #1238

Closed nicolasr75 closed 3 years ago

nicolasr75 commented 3 years ago

I was wondering whether I can test the polyfill in the browser with ES6 modules buildless?

Problem is:

proposal-temporal\lib\intrinsicclass.mjs

has this

import ESGetIntrinsic from 'es-abstract/GetIntrinsic.js';

but es-abstract uses only CommonJS modules which therefore results in the error

Uncaught SyntaxError: The requested module '../../es-abstract/GetIntrinsic.js' does not provide an export named 'default'

I can fix this by modifying GetIntrinsic.js to include export default module.exports but that would have to be done for dozens of other files.

Any idea?

ljharb commented 3 years ago

No, you'd need a bundler - as is generally the case for anything consumed from npm.

nicolasr75 commented 3 years ago

Ok, thanks!