Repository: zeppelin Updated Branches: refs/heads/master e0fafac75 -> fc9d542b7
[ZEPPELIN-2924] Fix broken javascript source map ### What is this PR for? Fixed broken javascript source map. The coverage loader should be used only for test env. **that's really annoying because we can't set breakpoint and even can't see the original source code.** ### What type of PR is it? [Bug Fix] ### What is the Jira issue? [ZEPPELIN-2924](https://issues.apache.org/jira/browse/ZEPPELIN-2924) ### How should this be tested? 1. run the webapp as dev mode: `localhost:9000` 2. open the developer console and click any log message 3. check whether source is minified or not. 4. execute `yarn run test` in the terminal to check that coverage feature works well. ### Screenshots (if appropriate) #### Before ![image](https://user-images.githubusercontent.com/4968473/30260684-cc095240-9703-11e7-9fd6-fe5bd370a6bd.png) ![image](https://user-images.githubusercontent.com/4968473/30260690-d4f3494c-9703-11e7-854b-29d6020eaa3c.png) #### After ![image](https://user-images.githubusercontent.com/4968473/30260654-a27579d6-9703-11e7-9d2a-a37c7ae7b148.png) ![image](https://user-images.githubusercontent.com/4968473/30260655-a9c62802-9703-11e7-9d29-be10df0302d7.png) ### Questions: * Does the licenses files need update? - NO * Is there breaking changes for older versions? - NO * Does this needs documentation? - NO Author: 1ambda <1am...@gmail.com> Closes #2580 from 1ambda/ZEPPELIN-2924/fix-source-map-is-broken and squashes the following commits: 375e13945 [1ambda] fix: Use coverage loader only for test env Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/fc9d542b Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/fc9d542b Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/fc9d542b Branch: refs/heads/master Commit: fc9d542b70d99ce334552af62f8730e2fde4c1d0 Parents: e0fafac Author: 1ambda <1am...@gmail.com> Authored: Mon Sep 11 15:09:10 2017 +0900 Committer: 1ambda <1am...@gmail.com> Committed: Wed Oct 11 19:40:09 2017 +0900 ---------------------------------------------------------------------- zeppelin-web/webpack.config.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/fc9d542b/zeppelin-web/webpack.config.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/webpack.config.js b/zeppelin-web/webpack.config.js index 6fba4b1..3c34924 100644 --- a/zeppelin-web/webpack.config.js +++ b/zeppelin-web/webpack.config.js @@ -120,6 +120,7 @@ module.exports = function makeWebpackConfig () { * Reference: http://webpack.github.io/docs/configuration.html#devtool * Type of sourcemap to use per build type */ + config.devtool = 'eval-source-map'; if (isTest) { config.devtool = 'inline-source-map'; } else if (isProd) { @@ -127,7 +128,6 @@ module.exports = function makeWebpackConfig () { } else { config.devtool = 'eval-source-map'; } - config.devtool = 'source-map'; /** * Loaders @@ -196,14 +196,6 @@ module.exports = function makeWebpackConfig () { } ]}) }], - postLoaders: [ - { - // COVERAGE - test: /\.js$/, - exclude: /(node_modules|bower_components|\.test\.js)/, - loader: 'istanbul-instrumenter' - } - ] }; /** @@ -250,6 +242,17 @@ module.exports = function makeWebpackConfig () { }) ) } + + if (isTest) { + config.module.postLoaders = [ + { + // COVERAGE + test: /\.js$/, + exclude: /(node_modules|bower_components|\.test\.js)/, + loader: 'istanbul-instrumenter' + } + ] + } // Add build specific plugins if (isProd) {