fettepalette
fettepalette copied to clipboard
Fix index.js mess in package.json
in parcel 1.x I have to
import {
generateRandomColorRamp
} from 'fettepalette/dist/index';
to make it work.
in vanilla node it works fine:
import {
generateRandomColorRamp
} from 'fettepalette'
canvas-sketch uses browserify const {generateRandomColorRamp} = require('fettepalette');
only returns an empty object
Hey, maybe it's due to Parcel preferring the "additional new" exports
key, so maybe adding something like this to the package would do:
"exports": {
".": {
"require": "./dist/index.js",
"import": "./dist/index.esm.js"
},
"./package.json": "./package.json"
}
(you can give it a try before publishing by editing the package.json inside your node_modules on a test project)
@lihbr thanks so much! I managed to fix it. I now have a build.js script that is easier to modify
I had to fix the imports using the following additions/modifications to the package.json
file in the node_modules/
folder. I described it aswell in #17.
...,
"exports": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
...
This worked for me and I'm using it as described. Does anyone have the time to test it aswell?
I'm lost
hey there, maybe it's worthwile to take a look at 'vite.js' which has a library mode. it really simplifies the developing and bundling process.