-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We don't want to include our dependencies (react, maplibre, and so on) in the final bundle: because library users download these as transitive deps we want to leave it up to them to resolve the imports and include them in the final app bundle. For instance, OSRD is responsible for inlining maplibre imports in ui-warped-map's bundle. On the other hand, relative imports local to the package should be bundled. By default, rollup only resolves relative imports, and doesn't resolve global imports. rollup prints an error when it encounters a global import that it can't resolve. We don't want to just ignore unresolved global imports, because that would silently allow broken non-existing imports. The @rollup/plugin-node-resolve plugin allows rollup to resolve global imports like node does. However, by default it includes all global imports in the bundle. This isn't what we want: we want to exclude dependencies from the bundle. To fix this, follow the recommendations in the rollup docs [1] and use the "external" option to check whether an import points to the "node_modules" directory or a "dist" directory of any osrd-ui package. In that case, ask rollup to not bundle the import. We don't need to manually specify a list of external imports from each package anymore. [1]: https://rollupjs.org/configuration-options/#external Signed-off-by: Simon Ser <[email protected]>
- Loading branch information
Showing
9 changed files
with
71 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
import generateBaseRollupConfig from '../rollup-base.config.js'; | ||
export default generateBaseRollupConfig('osrdcore', ['react']); | ||
|
||
export default generateBaseRollupConfig('osrdcore'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
import generateBaseRollupConfig from '../rollup-base.config.js'; | ||
export default generateBaseRollupConfig('osrdcore', ['react']); | ||
|
||
export default generateBaseRollupConfig('osrdcore'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
import generateBaseRollupConfig from '../rollup-base.config.js'; | ||
export default generateBaseRollupConfig('osrdcore', ['react']); | ||
|
||
export default generateBaseRollupConfig('osrdcore'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import generateBaseRollupConfig from '../rollup-base.config.js'; | ||
|
||
export default generateBaseRollupConfig('osrdcore', ['react']); | ||
export default generateBaseRollupConfig('osrdcore'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import generateBaseRollupConfig from '../rollup-base.config.js'; | ||
|
||
export default generateBaseRollupConfig('osrdcore', ['react']); | ||
export default generateBaseRollupConfig('osrdcore'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import generateBaseRollupConfig from '../rollup-base.config.js'; | ||
|
||
export default generateBaseRollupConfig('osrdTrackOccupancyDiagram', ['react']); | ||
export default generateBaseRollupConfig('osrdTrackOccupancyDiagram'); |