Skip to content

Commit 9a598fa

Browse files
spalgerw33ble
authored andcommitted
[webpack] upgrade to @elastic/webpack-directory-name-as-main v2 (#9601) (#9540)
* [npm] use elastic webpack fork * [webpack] upgrade to @elastic/webpack-directory-name-as-main v2 * bump @elastic/webpack-directory-name-as-main * import browser mocha with webpackShim `import 'mocha'` will resolve to `mocha/index.js`, which points to `mocha/lib/mocha.js`, the node version of mocha. This will not work in the browser. Since ng_mock is browser code, we need the mocha build for the browser, which lives at `mocha/mocha.js`. This isn't referenced at all in the package.json file, but is references in the bower.json file. Webpack, however, doesn't observe the bower config, so we need to specifically reach into the mocha package and point to the `mocha/mocha.js` file.
1 parent ca32e8f commit 9a598fa

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
"@bigfunger/jsondiffpatch": "0.1.38-webpack",
7575
"@elastic/datemath": "2.3.0",
7676
"@elastic/kibana-ui-framework": "0.0.13",
77+
"@elastic/webpack-directory-name-as-main": "2.0.2",
7778
"@spalger/filesaver": "1.1.2",
7879
"@spalger/leaflet-draw": "0.2.3",
7980
"@spalger/leaflet-heat": "0.1.3",
@@ -164,8 +165,7 @@
164165
"url-loader": "0.5.6",
165166
"validate-npm-package-name": "2.2.2",
166167
"vision": "4.1.0",
167-
"webpack": "github:spalger/webpack#fix/query-params-for-aliased-loaders",
168-
"webpack-directory-name-as-main": "1.0.0",
168+
"webpack": "github:elastic/webpack#fix/query-params-for-aliased-loaders",
169169
"whatwg-fetch": "0.9.0",
170170
"wreck": "6.2.0"
171171
},

src/optimize/base_optimizer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { writeFile } from 'fs';
33

44
import webpack from 'webpack';
55
import Boom from 'boom';
6-
import DirectoryNameAsMain from 'webpack-directory-name-as-main';
6+
import DirectoryNameAsMain from '@elastic/webpack-directory-name-as-main';
77
import ExtractTextPlugin from 'extract-text-webpack-plugin';
88
import CommonsChunkPlugin from 'webpack/lib/optimize/CommonsChunkPlugin';
99
import DefinePlugin from 'webpack/lib/DefinePlugin';

webpackShims/mocha.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('../node_modules/mocha/mocha.js');

0 commit comments

Comments
 (0)