-
Notifications
You must be signed in to change notification settings - Fork 362
multiple entry modules #545
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
Comments
Also, when I try to call the bundled js file example (src/Assembler.ts becomes dist/Assembler.js) I get the error |
Hi, not sure if I understand correctly but multiple entries are not yet supported by microbundle (AFAIK). See #50 For your second question it would help if you could provide steps to reproduce the problem. Seems as if it's tied to your application code |
Too bad for the multiple entries. I have a Typescript project the directory is:
When I compile using micro bundler it creates the dist folder with the final Assembler.js that contains the rest of the ts files as a single file. But when I open index.html that in turn calls index.js I get the error: SafariSyntaxError: Importing binding name 'default' cannot be resolved by star export entries. ChromeUncaught SyntaxError: The requested module './dist/Assembler.js' does not provide an export named 'default' I want to know if I can open the files created by Microbundler from a local server without needing web pack. |
Update: I manage to get the code running by importing Assembler.mjs instead of .js inside the index.js file |
Microbundle does support multiple entries that produce multiple outputs: {
"main": "dist/Assembler.js",
"scripts": {
"build": "microbundle src/*.ts"
}
} This will produce the following structure:
|
@developit if import {MyComponent} from 'my-module' Currently it seems that the multiple entry points needs to be adressed like: import MyComponent from 'my-module/MyComponent' Or do I misunderstand something? I am little bit confused how to handle this. I want to bundle a component repo with multiple components which have on single component basis Material-UI dependencies. I want to make sure that codesplitting is active. |
@dohomi Create an
|
@rschristian if I use one index.ts file then all dependencies of the components are loaded and if I want to only load |
@dohomi Any tool that can tree shake will shake out those unused imports (and their dependencies). Regardless, you asked
and this is how you do it. I don't quite understand how you're expecting this to work otherwise? |
@rschristian the main issue in my use case are external dependencies in the different components. I have a small library where I have materail-ui dependencies in the components. |
@dohomi All of the popular build tools should be more than capable of ensuring those external dependencies aren't in your bundle if the component they're included in is not used. |
@rschristian thanks for the clarification 👍 |
Hi, there I an example of a package.json where I can see how to configure the multiple entry modules or any documentation?
The text was updated successfully, but these errors were encountered: