Browse Source

added npm script and webpack config for viewer debugging

- generates sourcemaps that work with vscode/chrome debugging
Alexander Rose 5 years ago
parent
commit
2a4d45714c
3 changed files with 12 additions and 2 deletions
  1. 2 0
      package.json
  2. 3 2
      webpack.config.common.js
  3. 7 0
      webpack.config.viewer.debug.js

+ 2 - 0
package.json

@@ -19,10 +19,12 @@
     "build-webpack": "webpack --mode production",
     "watch": "concurrently -c \"green,gray,gray\" --names \"tsc,ext,wpc\" --kill-others \"npm:watch-tsc\" \"npm:watch-extra\" \"npm:watch-webpack\"",
     "watch-viewer": "concurrently -c \"green,gray,gray\" --names \"tsc,ext,wpc\" --kill-others \"npm:watch-tsc\" \"npm:watch-extra\" \"npm:watch-webpack-viewer\"",
+    "watch-viewer-debug": "concurrently -c \"green,gray,gray\" --names \"tsc,ext,wpc\" --kill-others \"npm:watch-tsc\" \"npm:watch-extra\" \"npm:watch-webpack-viewer-debug\"",
     "watch-tsc": "tsc --watch --incremental",
     "watch-extra": "cpx \"src/**/*.{scss,woff,woff2,ttf,otf,eot,svg,html,ico}\" lib/ --watch",
     "watch-webpack": "webpack -w --mode development --display minimal",
     "watch-webpack-viewer": "webpack -w --mode development --display errors-only --info-verbosity verbose --config ./webpack.config.viewer.js",
+    "watch-webpack-viewer-debug": "webpack -w --mode development --display errors-only --info-verbosity verbose --config ./webpack.config.viewer.debug.js",
     "serve": "http-server -p 1338",
     "model-server": "node lib/servers/model/server.js",
     "model-server-watch": "nodemon --watch lib lib/servers/model/server.js",

+ 3 - 2
webpack.config.common.js

@@ -18,7 +18,9 @@ const sharedConfig = {
                 test: /\.(s*)css$/,
                 use: [
                     MiniCssExtractPlugin.loader,
-                    'css-loader', 'resolve-url-loader', 'sass-loader'
+                    { loader: 'css-loader', options: { sourceMap: false } },
+                    { loader: 'resolve-url-loader', options: { sourceMap: false } },
+                    { loader: 'sass-loader', options: { sourceMap: false } },
                 ]
             }
         ]
@@ -54,7 +56,6 @@ const sharedConfig = {
     devtool: ''
 }
 
-
 function createEntry(src, outFolder, outFilename, isNode) {
     return {
         node: isNode ? void 0 : { fs: 'empty' }, // TODO find better solution? Currently used in file-handle.ts

+ 7 - 0
webpack.config.viewer.debug.js

@@ -0,0 +1,7 @@
+const createViewer = require('./webpack.config.viewer.js')[0];
+module.exports = [
+    {
+        ...createViewer,
+        devtool: 'eval'
+    }
+]