3 ms·
I haven't used native JS modules yet. I read through the linked page and it's not totally clear to me why you can't just import directly from node_modules. Wh
by leftyted 8y ago
I haven't used native JS modules yet.
I read through the linked page and it's not totally clear to me why you can't just import directly from node_modules. What Pika/web appears to do is find node_modules that use valid export syntax and copy them to a different dir. Is that correct? Am I missing something?
- plausibilities 8y ago>I read through the linked page and it's not totally clear to me why you can't just import directly from node_modules. Bingo This is why it doesn't fully pass the smell test for me
- coolreader18 8y agoBecause many modules don't use ES exports, especially the tiny annoying ones from people like sindresorhus that everything seems to rely on. ES modules are compatible with the browser, CommonJS modules are not.
- plausibilities 8y agohttps://github.com/purtuga/esm-webpack-plugin https://github.com/purtuga/esm-webpack-plugin + webpack libraryTarget So I basically don't exclude node_modules, and set up a simple webpack config to suck in my deps and output them as ESM modules to a given static dir of my choice