Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Bundle imports #12

Open
kaleidawave opened this issue Oct 13, 2020 · 0 comments
Open

Bundle imports #12

kaleidawave opened this issue Oct 13, 2020 · 0 comments
Labels
assets The asset compilation and bundling chef/javascript JS parsing and rendering

Comments

@kaleidawave
Copy link
Owner

Current imports are used for:

  • Importing Prism components so that templating is aware of custom tags
  • Importing @Globals for server
  • import type for the type resolving system

As of v1.0.2 Prism strips all imports and exports when bundling the whole application. This means that if you are importing a es module from another server then it will be removed.

Bundling is currently done via concatenating all <script>s in .prism definitions and .js and .ts files in the scripts folder of the assets path. Rather than via imports.

The stripping of imports and exports is done because effective code splitting is not quite worked out yet. And it over compensates by removing all imports as a bad static import would cause the script to not run.

And v1.0.2 is not a production build meant to integrate with other code. If importing is important then you can get away with dynamic imports.

Imports bundling and tree shaking are a bit out of the scope for chef rn so it would mean bringing webpack, rollup or other bundlers into the toolchain.

@kaleidawave kaleidawave added assets The asset compilation and bundling chef/javascript JS parsing and rendering labels Oct 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
assets The asset compilation and bundling chef/javascript JS parsing and rendering
Projects
None yet
Development

No branches or pull requests

1 participant