Just like rollup, spack emits compact output.
swc was designed with this type of merging in mind, files are merged without any problems even if the same name exists in multiple files.
Just like other modern bundlers,
spack can remove unused exports.
To aid tree shaking,
spack deglobs import if possible.
behaves exactly same as
Note that all side effects are preserved.
As almost all modules on npm are published as common js module, spack supports importing common js module. Also, spack emits compact output compared to webpack.
lib above is common js module, it's transcompiled as
- global inlining (e.g.
- constant propagation
- dead code elimination
Actually the tree shaking described above is implemented using the dead code elimination pass. Currently, spack / swc can deduce
As always, performance is a first-class citizen. It's very fast because it uses all cpu cores, and optimized by llvm.
You can use es2018, module import / export-s and some staged proposals without installing any additional dependency.
Let's suppose that we have the same config as above. If
web.ts both references a file, it will be extracted as a separate chunk and
amdroid.ts will import it.
spack provides type annotations for the config. You can get assists from ide just by wrappping your configuration object with
config. Note that it's just an identity function with type annoatations.
If you want to bundle everything in each bundle, you can provide an array of configurations.
results in two full bundle (
results in chunking. In this case, the output will be
common-[hash].js, assuming there's a common dependency.
spack will provide webpack-compatible apis, so you will be able to use webpack loaders and plugins without changing the plugin. All you need to do will be changing file name and imports.
I couldn't implement this because currently there's no way to wait for a promise to be resolved from rust code. I'll implement this feature as soon as possible after neon#73 or node-bidgen#37 is fixed. (I'm open to switchig from neon to node-bindgen).
I think this is one of the core features of a bundler. I'll implement it soon.