Closed mesqueeb closed 6 years ago
It's not going to work out-of-the-box since this package currently is a CJS module as opposed to a JS module.
It would work if you use tooling that magically translates import
to require
behind the scenes, but that's a lossy translation.
Have you considered adding a rollup build to provide a ES module next to the CJS module? You can separate both builds in the package.json under module
and main
.
I usually do it like so:
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
If you want I can make a pull request, but everyone has their preferred methods of building.
Looking forward to the future! : )
Sure, send over that PR! Thanks.
@mathiasbynens
I did exactly what I said. : D
I used a very basic rollup build. And in the package.json I offered the es6 module under module
next to the main
which I had set to the commonjs, as this is common practise. ; )
You can build with npm run rollup
Is it possible to write
instead of
? If so, could you add this to the readme! Cheers!!