mike-north / ember-monaco

Monaco editor for Ember.js apps
BSD 2-Clause "Simplified" License
18 stars 15 forks source link

Can't build for production with sourcemaps enabled #54

Open abhishek97 opened 5 years ago

abhishek97 commented 5 years ago

I cannot build an ember app for production if i enable sourcemaps

let app = new EmberApp(defaults, {
    // Add options here
    sourcemaps: {
      enabled: true,
      extensions: ['js']
    },
}

Error:

Circular dependency: ../../../../private/var/folders/5g/t2x1c1gj70x2zhgfhfwyzzh40000gn/T/broccoli-453285N7yqGAz5n1W/cache-104-rollup/build/editor-scripts/conn.js -> ../../../../private/var/folders/5g/t2x1c1gj70x2zhgfhfwyzzh40000gn/T/broccoli-453285N7yqGAz5n1W/cache-104-rollup/build/editor-scripts/editor.js -> ../../../../private/var/folders/5g/t2x1c1gj70x2zhgfhfwyzzh40000gn/T/broccoli-453285N7yqGAz5n1W/cache-104-rollup/build/editor-scripts/conn.js
[WARN] (broccoli-uglify-sourcemap) "../../../../min-maps/vs/base/worker/workerMain.js.map" referenced in "ember-monaco/vs/base/worker/workerMain.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.js.map" referenced in "ember-monaco/vs/editor/editor.main.js" could not be found
[WARN] (broccoli-uglify-sourcemap) Minifying "ember-monaco/vs/base/worker/workerMain.js" took: 20638ms (more than 20,000ms)
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.de.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.de.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.es.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.es.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.fr.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.fr.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.it.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.it.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ja.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ja.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ko.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ko.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ru.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ru.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.zh-cn.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.zh-cn.js" could not be found
[WARN] (broccoli-uglify-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.zh-tw.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.zh-tw.js" could not be found
[WARN] (broccoli-uglify-sourcemap) Minifying "assets/vendor.js" took: 75230ms (more than 20,000ms)
[WARN] (broccoli-uglify-sourcemap) Minifying "ember-monaco/vs/editor/editor.main.js" took: 71011ms (more than 20,000ms)
Build Error (UglifyWriter)

EISDIR: illegal operation on a directory, read

It can reproduced on a new ember app. For now, just excluding it from uglify works.

mike-north commented 5 years ago

interesting. I don't have time to dig into this, but if you manage to find a fix I would welcome it

nbibler commented 3 years ago

Similar issue here, as well. Although this app has no direct dependency on uglify / broccoli-uglify-sourcemap. Instead, it seems to be coming from broccoli-terser-sourcemap via ember-cli-terser.

[TerserWriter][WARN] (broccoli-terser-sourcemap) "../../../../min-maps/vs/base/worker/workerMain.js.map" referenced in "ember-monaco/vs/base/worker/workerMain.js" could not be found
[TerserWriter][WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.de.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.de.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.es.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.es.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.js.map" referenced in "ember-monaco/vs/editor/editor.main.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.fr.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.fr.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.it.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.it.js" could not be found
[TerserWriter][WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ja.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ja.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ko.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ko.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.ru.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.ru.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.zh-cn.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.zh-cn.js" could not be found
[WARN] (broccoli-terser-sourcemap) "../../../min-maps/vs/editor/editor.main.nls.zh-tw.js.map" referenced in "ember-monaco/vs/editor/editor.main.nls.zh-tw.js" could not be found
[TerserWriter][WARN] (broccoli-terser-sourcemap) Minifying "assets/vendor.js" took: 21503ms (more than 20,000ms)
cleaning up...
- build failed
Error: EISDIR: illegal operation on a directory, read

The backtrace:

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:498:3)
    at tryReadSync (fs.js:332:20)
    at Object.readFileSync (fs.js:369:19)
    at getSourceMapContent (/path/to/app/node_modules/broccoli-terser-sourcemap/lib/get-sourcemap-content.js:18:30)
    at processFile (/path/to/app/node_modules/broccoli-terser-sourcemap/lib/process-file.js:38:19)
    at Function.processFileParallel (/path/to/app/node_modules/broccoli-terser-sourcemap/lib/worker.js:9:10)
    at process.<anonymous> (/path/to/app/node_modules/workerpool/src/worker.js:121:27)
    at process.emit (events.js:198:13)
    at emit (internal/child_process.js:832:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)Pipeline aborted

I haven't yet dug into the magic setting to narrowly fix this issue, but disabling ember-cli-terser entirely certainly does the trick. ;)

--- a/ember-cli-build.js
+++ b/ember-cli-build.js
@@ -109,14 +109,7 @@ module.exports = function (defaults) {
     "ember-cli-terser": {
+      enabled: false,
     },

Update 2020-12-23: Seemingly disabling just the sourceMap setting terser via ember-cli-terser does the trick:

--- a/ember-cli-build.js
+++ b/ember-cli-build.js
@@ -109,14 +109,7 @@ module.exports = function (defaults) {
     "ember-cli-terser": {
+      terser: {
+        sourceMap: false,
+      }
     },