PrismJS / prism-themes

A wider selection of Prism themes
MIT License
1.4k stars 504 forks source link

remove main field from package.json #114

Closed huozhi closed 3 years ago

huozhi commented 3 years ago

e.g. browserless is depending on prism-themes. when I use pkg to bundle a script using browserless. prism-themes is failed to be bundled

RunDevelopment commented 3 years ago

I can see that main: README.md doesn't make much sense but will removing the main field help? From my understanding, a missing main field is roughly equivalent to main: index.js.

huozhi commented 3 years ago

@RunDevelopment I'm not sure how bundler handle package with any entry. If it's required to have one, do you feel it's proper to change the main entry to a empty one, like fbjs/index.js ?

// index.js
throw new Error('This package should not be required without a full path.');
RunDevelopment commented 3 years ago

Hmmm, I don't really like having a useless JS file just work around this.

Question: Have you checked that removing the main field actually fixes your problem? If it works with the bundler you use, it'll probably also work with others.

huozhi commented 3 years ago

yeah I've tested locally with removing main field from package.json in node_modules, problem solved. I'd expect regular css imports with absolute path won't cause this issue.

RunDevelopment commented 3 years ago

If it works for you, it'll probably also work for others. Right now, it just can't work, so let's merge this.

huozhi commented 3 years ago

Thank you @RunDevelopment