scalacenter / scalajs-bundler

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

sourcemap not work with BundlingMode.LibraryAndApplication #431

Open doofin opened 2 years ago

doofin commented 2 years ago

Hi it seems that sourcemap can't be generated with BundlingMode.LibraryAndApplication, js-fastopt-library.js.map

Fast optimizing /home/dg/work/scala-cross/js/target/scala-2.13/js-fastopt [info] Bundling dependencies with source maps

[error] internal/fs/utils.js:332 [error] throw err; [error] ^ [error] Error: ENOENT: no such file or directory, open '/home/dg/work/scala-cross/js/target/scala-2.13/scalajs-bundler/main/js-fastopt-library.js.map' [error] at Object.openSync (fs.js:498:3) [error] at Object.readFileSync (fs.js:394:35) [error] at Object. (/home/dg/work/scala-cross/js/target/scala-2.13/scalajs-bundler/main/scalajsbundler-concat-js-fastopt-bundle.js:5:136) [error] at Module._compile (internal/modules/cjs/loader.js:1085:14) [error] at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) [error] at Module.load (internal/modules/cjs/loader.js:950:32) [error] at Function.Module._load (internal/modules/cjs/loader.js:790:12) [error] at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) [error] at internal/main/run_main_module.js:17:47 { [error] errno: -2, [error] syscall: 'open', [error] code: 'ENOENT', [error] path: '/home/dg/work/scala-cross/js/target/scala-2.13/scalajs-bundler/main/js-fastopt-library.js.map'

relevant configs are:


      webpackBundlingMode := BundlingMode.LibraryAndApplication(),
      webpackEmitSourceMaps := true,
      scalaJSUseMainModuleInitializer := true,
      scalaJSLinkerConfig := StandardConfig()
//        .withSourceMap(false)
        .withSourceMap(true) // not work with LibraryAndApplication?
        .withModuleKind(
          ModuleKind.CommonJSModule
        ), //      https://github.com/scala-js/scala-js/issues/4305
      scalaJSLinkerConfig ~= { _.withESFeatures(_.withAvoidClasses(false)) },

scalajs-bundler versions : 0.21.0-RC1 0.20.0