rohan-deshpande / js-hqx

javascript & canvas pixel art scaling algorithm
Other
5 stars 1 forks source link

Cannot import with Rollup #1

Open jayschwa opened 7 years ago

jayschwa commented 7 years ago
[!] Error: 'default' is not exported by node_modules/js-hqx/dist/hqx.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
src/utils.js (1:7)
1: import hqx from "js-hqx"
          ^

Using Rollup v0.50.0 with js-hqx v1.0.0.

rohan-deshpande commented 7 years ago

That's weird, it's working fine with web pack. I don't use roll up myself... perhaps it's something to do with the web pack module stuff in the main file.

jayschwa commented 7 years ago

Yes that seems to be the case. If I remove everything before exports.default = ... and change that to export default, then it works.

rohan-deshpande commented 6 years ago

I'll have to do a bit of research to see how to get webpack to bundle this in a way that rollup can use.

Edit: @jayschwa do you mind pointing me to a module published with webpack with does work with rollup? Just need to take a peek at how they are doing things.

techandsoftware commented 3 years ago

I've just hit the same issue. I'm not sure what the issue with the generated UMD is. I found adding a 'module' definition in package.json worked, pointing to the source and not the generated umd

"module": "./src/hqx.js",

This is mentioned here: https://rollupjs.org/guide/en/#publishing-es-modules

Here's an example of a published module I'm using that does work: https://github.com/c9fe/Uint1Array