Fix npm start on windows, fixes #119, #118

This commit is contained in:
Roman Hotsiy 2016-09-28 00:30:33 +03:00
parent f02a23b280
commit 79693e1b27
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
5 changed files with 28 additions and 17 deletions

View File

@ -13,7 +13,6 @@ module.exports = {
resolve: { resolve: {
extensions: ['.ts', '.js', '.json', '.css'], extensions: ['.ts', '.js', '.json', '.css'],
alias: { alias: {
'./lib/bootstrap': root('lib/bootstrap.dev'),
http: 'stream-http', http: 'stream-http',
https: 'stream-http' https: 'stream-http'
} }
@ -55,7 +54,8 @@ module.exports = {
}, },
module: { module: {
loaders: [{ exprContextCritical: false,
rules: [{
enforce: 'pre', enforce: 'pre',
test: /\.js$/, test: /\.js$/,
loader: 'source-map-loader', loader: 'source-map-loader',
@ -70,13 +70,13 @@ module.exports = {
], ],
exclude: [/\.(spec|e2e)\.ts$/] exclude: [/\.(spec|e2e)\.ts$/]
}, { }, {
test: /lib\/.*\.css$/, test: /lib[\\\/].*\.css$/,
loaders: ['raw-loader'], loaders: ['raw-loader'],
exclude: [/redoc-initial-styles\.css$/] exclude: [/redoc-initial-styles\.css$/]
}, { }, {
test: /\.css$/, test: /\.css$/,
loaders: ['style', 'css?-import'], loaders: ['style', 'css?-import'],
exclude: [/lib\/(?!.*redoc-initial-styles).*\.css$/] exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.css$/]
}, { }, {
test: /\.html$/, test: /\.html$/,
loader: 'raw-loader' loader: 'raw-loader'
@ -93,7 +93,8 @@ module.exports = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'IS_PRODUCTION': IS_PRODUCTION, 'IS_PRODUCTION': IS_PRODUCTION,
'LIB_VERSION': VERSION 'LIB_VERSION': VERSION,
'AOT': IS_PRODUCTION
}), }),
new ForkCheckerPlugin() new ForkCheckerPlugin()

View File

@ -48,7 +48,8 @@ module.exports = {
}, },
module: { module: {
loaders: [{ exprContextCritical: false,
rules: [{
enforce: 'pre', enforce: 'pre',
test: /\.js$/, test: /\.js$/,
loader: 'source-map-loader', loader: 'source-map-loader',
@ -84,7 +85,8 @@ module.exports = {
new webpack.BannerPlugin(BANNER), new webpack.BannerPlugin(BANNER),
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'IS_PRODUCTION': true, 'IS_PRODUCTION': true,
'LIB_VERSION': VERSION 'LIB_VERSION': VERSION,
'AOT': true
}) })
], ],
} }

View File

@ -10,7 +10,6 @@ module.exports = {
resolve: { resolve: {
extensions: ['.ts', '.js', '.json', '.css'], extensions: ['.ts', '.js', '.json', '.css'],
alias: { alias: {
'./lib/bootstrap': root('lib/bootstrap.dev'),
http: 'stream-http', http: 'stream-http',
https: 'stream-http' https: 'stream-http'
} }
@ -37,6 +36,7 @@ module.exports = {
}, },
module: { module: {
exprContextCritical: false,
rules: [{ rules: [{
enforce: 'pre', enforce: 'pre',
test: /\.js$/, test: /\.js$/,
@ -56,13 +56,13 @@ module.exports = {
], ],
exclude: [/\.(spec|e2e)\.ts$/] exclude: [/\.(spec|e2e)\.ts$/]
}, { }, {
test: /lib\/.*\.css$/, test: /lib[\\\/].*\.css$/,
loaders: ['raw-loader'], loaders: ['raw-loader'],
exclude: [/redoc-initial-styles\.css$/] exclude: [/redoc-initial-styles\.css$/]
}, { }, {
test: /\.css$/, test: /\.css$/,
loaders: ['style', 'css?-import'], loaders: ['style', 'css?-import'],
exclude: [/lib\/(?!.*redoc-initial-styles).*\.css$/] exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.css$/]
}, { }, {
test: /\.html$/, test: /\.html$/,
loader: 'raw-loader' loader: 'raw-loader'
@ -86,7 +86,8 @@ module.exports = {
plugins: [ plugins: [
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'IS_PRODUCTION': false, 'IS_PRODUCTION': false,
'LIB_VERSION': VERSION 'LIB_VERSION': VERSION,
'AOT': 'false'
}), }),
new webpack.LoaderOptionsPlugin({ new webpack.LoaderOptionsPlugin({
test: /\.ts$/, test: /\.ts$/,
@ -97,11 +98,11 @@ module.exports = {
}), }),
// ignore changes during tests // ignore changes during tests
new webpack.WatchIgnorePlugin([ new webpack.WatchIgnorePlugin([
/\/ReDoc$/i, // ignore change of ReDoc folder itself /[\\\/]ReDoc$/i, // ignore change of ReDoc folder itself
/node_modules\/(?:[^\/]*(?:\/|$))*[^\/]*$/, /node_modules[\\\/].*$/,
/\.tmp\/(?:[^\/]*(?:\/|$))*[^\/]*$/, /\.tmp[\\\/].*$/,
/dist\/(?:[^\/]*(?:\/|$))*[^\/]*$/, /dist[\\\/].*$/,
/(?:[^\/]*(?:\/|$))*[^\/]*\.css$/ // ignore css files /(?:[^\\\/]*(?:[\\\/]|$))*[^\\\/]*\.css$/ // ignore css files
]) ])
], ],
} }

View File

@ -6,7 +6,13 @@ import { Redoc } from './components/index';
import { SpecManager } from './utils/SpecManager'; import { SpecManager } from './utils/SpecManager';
import { BrowserDomAdapter as DOM } from './utils/browser-adapter'; import { BrowserDomAdapter as DOM } from './utils/browser-adapter';
import { disableDebugTools } from '@angular/platform-browser'; import { disableDebugTools } from '@angular/platform-browser';
import { bootstrapRedoc } from './bootstrap';
var bootstrapRedoc;
if (AOT) {
bootstrapRedoc = require('./bootstrap').bootstrapRedoc;
} else {
bootstrapRedoc = require('./bootstrap.dev').bootstrapRedoc;
}
if (IS_PRODUCTION) { if (IS_PRODUCTION) {
disableDebugTools(); disableDebugTools();

View File

@ -14,6 +14,7 @@ declare module "*.css" {
declare var LIB_VERSION: any; declare var LIB_VERSION: any;
declare var IS_PRODUCTION: any; declare var IS_PRODUCTION: any;
declare var AOT: any;
interface ErrorStackTraceLimit { interface ErrorStackTraceLimit {
stackTraceLimit: number; stackTraceLimit: number;