Commit a7058452 by Johannes Edmeier Committed by Johannes Edmeier

Fix the webpack build on windows

Make the webpackconfig handle windows paths correctly. fixes #363
parent be34f1d2
...@@ -9,6 +9,8 @@ var NgAnnotatePlugin = require('ng-annotate-webpack-plugin'), ...@@ -9,6 +9,8 @@ var NgAnnotatePlugin = require('ng-annotate-webpack-plugin'),
var DIST = path.resolve(__dirname, 'target/dist'); var DIST = path.resolve(__dirname, 'target/dist');
var ROOT = __dirname; var ROOT = __dirname;
var qPathSep = path.sep === '\\' ? '\\\\' : '/';
module.exports = { module.exports = {
context: ROOT, context: ROOT,
entry: { 'applications-hystrix': './src/module.js' }, entry: { 'applications-hystrix': './src/module.js' },
...@@ -30,21 +32,21 @@ module.exports = { ...@@ -30,21 +32,21 @@ module.exports = {
preLoaders: [{ preLoaders: [{
test: /\.js$/, test: /\.js$/,
loader: 'eslint', loader: 'eslint',
exclude: [/node_modules/, /target\/hystrix-dashboard/] exclude: [/node_modules/, /hystrix-dashboard/]
}], }],
loaders: [ loaders: [
{ {
test: /hystrix-dashboard\/js\/jquery\.tinysort\.min\.js$/, test: new RegExp('hystrix-dashboard'+qPathSep+'js'+qPathSep+'jquery\.tinysort\.min\.js$'),
loader: 'imports?jQuery=jquery' loader: 'imports?jQuery=jquery'
}, { }, {
test: /hystrix-dashboard\/components\/hystrixCommand\/hystrixCommand\.js$/, test: new RegExp('hystrix-dashboard'+qPathSep+'components'+qPathSep+'hystrixCommand'+qPathSep+'hystrixCommand\.js$'),
loaders: [ loaders: [
'imports?this=>global&jQuery=jquery&$=jquery&d3&tmpl=microtemplates&tsort', 'imports?this=>global&jQuery=jquery&$=jquery&d3&tmpl=microtemplates&tsort',
'exports?window.HystrixCommandMonitor', 'exports?window.HystrixCommandMonitor',
'regexp-replace?{"match": { "pattern": "\.\./components/hystrixCommand", "flags": "g" }, "replaceWith": "applications-hystrix/components/hystrixCommand"}' 'regexp-replace?{"match": { "pattern": "\.\./components/hystrixCommand", "flags": "g" }, "replaceWith": "applications-hystrix/components/hystrixCommand"}'
] ]
}, { }, {
test: /hystrix-dashboard\/components\/hystrixThreadPool\/hystrixThreadPool\.js$/, test: new RegExp('hystrix-dashboard'+qPathSep+'components'+qPathSep+'hystrixThreadPool'+qPathSep+'hystrixThreadPool\.js$'),
loaders: [ loaders: [
'imports?this=>global&jQuery=jquery&$=jquery&d3&tmpl=microtemplates&tsort', 'imports?this=>global&jQuery=jquery&$=jquery&d3&tmpl=microtemplates&tsort',
'exports?HystrixThreadPoolMonitor', 'exports?HystrixThreadPoolMonitor',
......
...@@ -12,13 +12,13 @@ var DIST = path.resolve(__dirname, 'target/dist'); ...@@ -12,13 +12,13 @@ var DIST = path.resolve(__dirname, 'target/dist');
var ROOT = __dirname; var ROOT = __dirname;
var isDevServer = path.basename(require.main.filename) === 'webpack-dev-server.js'; var isDevServer = path.basename(require.main.filename) === 'webpack-dev-server.js';
var allModules = glob.sync(ROOT + '/modules/*/module.js').map(function (file) { var allModules = glob.sync(path.join(ROOT,'/modules/*/module.js')).map(function (file) {
var name = /modules\/([^\/]+)\/module\.js/.exec(file)[1]; var name = /modules\/([^\/]+)\/module\.js/.exec(file)[1];
return { return {
name: name, name: name,
bundle: name + '/module', bundle: name + '/module',
entry: './' + path.relative(ROOT, file), entry: '.' + path.sep + path.relative(ROOT, file),
outputPath: name + '/' outputPath: name + path.sep
}; };
}); });
...@@ -94,19 +94,34 @@ module.exports = { ...@@ -94,19 +94,34 @@ module.exports = {
loader: ExtractTextPlugin.extract('style', 'css?-minimize') loader: ExtractTextPlugin.extract('style', 'css?-minimize')
}, { }, {
test: /\.(jpg|png|gif|eot|svg|ttf|woff(2)?)(\?.*)?$/, test: /\.(jpg|png|gif|eot|svg|ttf|woff(2)?)(\?.*)?$/,
include: /\/(third-party|node_modules)\//, include: /third-party/,
loader: 'file', loader: 'file',
query: { query: {
name: 'third-party/[2]', name: '[path][name].[ext]'
regExp: '(third-party|node_modules)/(.+)' }
}, {
test: /\.(jpg|png|gif|eot|svg|ttf|woff(2)?)(\?.*)?$/,
include: /node_modules/,
loader: 'file',
query: {
name: 'third-party/[path][name].[ext]',
context: 'node_modules'
} }
}, { }, {
test: /\.(jpg|png|gif)$/, test: /\.(jpg|png|gif)$/,
include: /\/(core|modules)\//, include: /core/,
loader: 'file',
query: {
name: '[path][name].[ext]',
context: 'core'
}
}, {
test: /\.(jpg|png|gif)$/,
include: /modules/,
loader: 'file', loader: 'file',
query: { query: {
name: '[2]', name: '[path][name].[ext]',
regExp: '(core|modules)/(.+)$' context: 'modules'
} }
}] }]
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment