Support packages with multiple modules #667
maxwell8888
started this conversation in
General
Replies: 2 comments 2 replies
-
Hey Max, Snowpack should handle this use case just fine. By default, Snowpack will scan your project for all imports and then install dependencies based on exactly what you import. In your exact example, you'd have both In your project, you just import them as you would in any other bundled dev environment and Snowpack takes care of the rest. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Great feedback, added to #627 ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Some npm packages have multiple entry points, so it does not make sense to bundle them into a single file in
web_modules
. For example, the lit-html package has a main entry point"module": "lit-html.js",
which is bundled intoweb_modules
also aslit-html.js
, allowingimport { html, render } from 'lit-html';
to execute successfully.However, there are also other modules which the package provides, for example
directives/until.js
(these are documented inpackage.json
underfiles: [ ... ]
) which are intended to be importable with, for example,import { until } from 'lit-html/directives/until.js';
. This is handled fine by rollup which is the tool I am currently using, but obviously not by snowpack, since it only bundles the single file.Is it possible to configure snowpack to handle this case?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions