../../../../src/main/scala/org/...
http://localhost:9000/src/main/scala/org/...
http://host/src/*
for the browser to resolve them. Which I'm somewhat OK doing as it's only for development purposes, I can disable that route for production. But since it worked "out of the box" previously before I switched to scalajs-bundler, I thought I'd see if there's a better solution first.
Is there a write up about reducing the bundle size? Quickly scanning through this channel it's kind of a duplicate quesetion being asked... I've seen some docs Bundling mode, but I think there is more to it I think:
At the moment with fullOptJS::webpack
my bundle size is 7,2 mb (using scalajs-react, circe, endpoints4s, droste (local build)).. I guess there are transitive dependencies and maybe code which is not being used?
fullOptJS
does minify the output of Scala.js, but it doesn’t process your dependencies).
const glob = require('glob');
const purgecss = require('@fullhuman/postcss-purgecss')
module.exports = {
plugins: [
require('postcss-import'),
require('tailwindcss'),
require('autoprefixer'),
purgecss({
content: glob.sync('../../../../**/*.scala'),
defaultExtractor: content => {
const regex = /className := "(.*?)"/g;
const result = [...content.matchAll(regex)].map(match => match[1]) || [];
return result.map(x => x.split(' ')).flat();
}
})
]
};
JSImport
but the output js remains the same
@js.native
@JSImport("ace-builds/src-noconflict/mode-scala.js", JSImport.Namespace)
object scalamode extends js.Object
scalamode
in my program entry point
source-map-loader
used here: