-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using rollup to generate import-maps #108
Comments
Hi, So far I like it very much since I can build different projects separately when any of them changes and only the Given two projects // app/src/index.js
import {form, formField} from '@x/forms';
// ...
export default app;
// forms/rollup.config.js
plugins: [
importMap({
'src/index.js': '@x/forms',
})
]
// app/rollup.config.js
external: ['@x/forms'],
plugins: [
importMap({
'src/index.js': '@x/app',
'src/some-public-module.js': '@x/some-public-module'
})
] After building both projects two json files are generated: // dist/forms/map.json
{
"@x/forms": "forms/index.asdf1234.js"
}
// dist/app/map.json
{
"@x/app": "app/index.asdf1234js",
"@x/some-public-module": "app/some-public-module.asdf1234.js"
} resulting in a map from package names to rollup generated chunks. Finally a custom node module generates the import-map by merging all individual // dist/import-map.json
{
"imports":{
"@x/forms": "forms/index.asdf1234.js",
"@x/app": "app/index.asdf1234js",
"@x/some-public-module": "app/some-public-module.asdf1234.js"
}
} |
wouldn't it be more like that rollup should take in an "import map" and use it to resolve the paths? That way you could control which files actually are going to end up in your bundle.
|
Closes #60. Closes #108. We'll discuss in #146 instead! Co-Authored-By: Guy Bedford <[email protected]>
Closes WICG#60. Closes WICG#108. We'll discuss in WICG#146 instead! Co-Authored-By: Guy Bedford <[email protected]>
Has anyone explored building a rollup plugin to generate
import-map
as an output ?This would move us closer to an unprocessed shipped code. Also, help in some development workflows.
The text was updated successfully, but these errors were encountered: