Comments (10)
Why is the Compile scope not needed for withModuleKind, but is needed for withMinify?
Because of how we configure the fullLink config:
You'll notice this is scoped in both the configuration and the task. I guess at some point in the past, we decided (explicitly or implicitly) it's more important to be able to re-configure configs easily then re-configure fast v.s. full defaults easily. (I'm making the assumption here that sbt axis are not hierarchical but I believe this is the case).
I can prepare PR for that if desired.
Always appreciated. Please do note that the commit structure of that repo is a bit odd: The commits correspond to steps. So you essentially need to rewrite its entire history to update it.
Would this also be in scope of the Basic Tutorial?
IMO no. The basic tutorial is officially "old" (as you can see from the Tutorial Overview). The Scala.js and Vite tutorial does perform JS minification (or more precisely Vite's production build does).
from scala-js.
First, always use fastLinkJS
/fullLinkJS
when configuring, even if you use the Opt
tasks in the end.
Second, just fastLinkJS /
never does anything. It's always Compile / fastLinkJS /
.
from scala-js.
Yes. Also, the config is documented in source:
linker-interface/shared/src/main/scala/org/scalajs/linker/interface/StandardConfig.scala
Seems like the scaladoc comments are not in the right place. We should obviously fix that.
from scala-js.
I do not think the GCC stops being used unless I use scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
. With CommonJSModule
I always see [info] Closure: 0 error(s), 0 warning(s)
and the filesize is exactly what is was before.
from scala-js.
Ah, right. I think you need to scope it in the config as well:
Compile / fullLinkJS / scalajsLinkerConfig
from scala-js.
Confirmed, with Compile / fullLinkJS
I can choose the minifier.
Why is the Compile
scope not needed for withModuleKind
, but is needed for withMinify
? How about withOptimizer
- does it need the Compile
scope as well?
I am checking some other basic documentation and tutorials. If you clone https://github.com/scala-js/scalajs-tutorial, it uses ancient versions of sbt and Scala.js, IntelliJ is unable to import the project. I can prepare PR for that if desired.
A bit related: it seems the minifier assumes some other JS minification will be done later in the pipeline, at least its ScalaDoc says so. Would this also be in scope of the Basic Tutorial?
from scala-js.
Thanks for the explanation.
How about
withOptimizer
- does it need theCompile
scope as well?
Still unclear about withOptimizer(false)
- should it be used from Compile / fastOptJS
or just fastOptJS
?
from scala-js.
Explanation is good, but the main point of this issue is to improve documentation so that the explanation here is not necessary.
Besides the links I have provided, some related documentation seems to be present in https://www.scala-js.org/doc/project/building.html as well. However I doubt I want to have this in my SBT:
scalaJSLinkerConfig ~= { _.withOptimizer(false) }
I would almost certanly want to disable optimizer for fastOpt
only, because that is where I expect to do my debugging.
from scala-js.
First, always use
fastLinkJS
/fullLinkJS
when configuring
I have tried it now with the Scala.js Tutorial project.
This affects fastOptJS
output:
Compile / fastOptJS / scalaJSLinkerConfig ~= (_.withOptimizer(false))
Compile / fastLinkJS / scalaJSLinkerConfig ~= (_.withOptimizer(false))
fastOptJS / scalaJSLinkerConfig ~= (_.withOptimizer(false))
This does not:
fastLinkJS / scalaJSLinkerConfig ~= (_.withOptimizer(false))
from scala-js.
Related Issues (20)
- Investigate linker memory consumption HOT 6
- Optimized compiler and linker processing of changes to literals and source code formatting HOT 8
- NullPointerException not caught by Try under scala.js HOT 2
- Facade `WeakMap` and `WeakSet`
- Support for "asynchronous exports" HOT 8
- String#codePoints does not compile on scala.js HOT 6
- Implement Java Streams HOT 5
- Add WebAssembly Linker Backend (with WasmGC and Wasm ExceptionHandling) HOT 13
- Assertion failed: Trying to move a local VarDef after the super constructor call of a non-native JS class HOT 4
- AnalyzerRun.WorkTracker loses track of tasks when there is a Failure
- Investigate Fishy Record Names in Optimizer Core HOT 2
- Prevent implicit conversion of A | Null to A | B HOT 1
- Wrong pretty-printing of JS tree that *starts* with an object lit
- Error while running `sbt`: bad constant pool index: 0 at pos: 48445 using Java version 21.0.1 HOT 3
- Race condition in AnalyzerRun.WorkTracker during `allowComplete()`.
- scala.util.Try does not catch `ClassCastException` HOT 1
- ConflictingTopLevelExport error reports incomplete error message
- linkerJS2_13/test spuriously fails too often on the CI (Killed)
- Locals stored as private symbols on non-native JS types breaks JS semantics HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scala-js.