scalacenter / scalajs-bundler

https://scalacenter.github.io/scalajs-bundler
Other
237 stars 101 forks source link

Fixes JS files to be included when using library-only bundling mode #281

Closed markusa380 closed 2 years ago

markusa380 commented 5 years ago

With the current version the emitted JS files are

julienrf commented 5 years ago

Thanks for helping, @MarkusA380!

I’m wondering why we generate yourapp-fastopt-library.js in the first place, instead of yourapp-library.js. I see no reason why it could be different between fastOptJS and fullOptJS. Same for the loader.

Maybe @cquiroz or @easel has an idea?

cquiroz commented 5 years ago

i'm not sure about the original reason. We can change the name using a webpack config, perhaps that is being observed?

markusa380 commented 5 years ago

I think it should always be yourapp-library.js, yourapp-loader.js and yourapp.js, or when not using the libary mode yourapp-bundle.js. Whether you use fastOptJS and fullOptJS should not make a difference in the results, which would simplify any further processing of the scripts (copying, deployment) and make it more beginner friendly overall.

easel commented 5 years ago

I think the naming convention was simply trying to mirror the output of the scala-js output file. I don't think theres necessarily any benefit to name-mangling -loader and -library.

In full bundling mode perhaps it would be beneficial to keep both versions around since Scala.js does the same?

julienrf commented 5 years ago

@MarkusA380 Using different names for the bundles generated by fullOptJS::webpack and fastOptJS::webpack allows us to cache the result of these tasks. Otherwise we would have to always re-evaluate the tasks.