Skip to content

Commit

Permalink
Fix npm start on windows, fixes #119, #118
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Sep 27, 2016
1 parent f02a23b commit 79693e1
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
11 changes: 6 additions & 5 deletions build/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module.exports = {
resolve: {
extensions: ['.ts', '.js', '.json', '.css'],
alias: {
'./lib/bootstrap': root('lib/bootstrap.dev'),
http: 'stream-http',
https: 'stream-http'
}
Expand Down Expand Up @@ -55,7 +54,8 @@ module.exports = {
},

module: {
loaders: [{
exprContextCritical: false,
rules: [{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader',
Expand All @@ -70,13 +70,13 @@ module.exports = {
],
exclude: [/\.(spec|e2e)\.ts$/]
}, {
test: /lib\/.*\.css$/,
test: /lib[\\\/].*\.css$/,
loaders: ['raw-loader'],
exclude: [/redoc-initial-styles\.css$/]
}, {
test: /\.css$/,
loaders: ['style', 'css?-import'],
exclude: [/lib\/(?!.*redoc-initial-styles).*\.css$/]
exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.css$/]
}, {
test: /\.html$/,
loader: 'raw-loader'
Expand All @@ -93,7 +93,8 @@ module.exports = {

new webpack.DefinePlugin({
'IS_PRODUCTION': IS_PRODUCTION,
'LIB_VERSION': VERSION
'LIB_VERSION': VERSION,
'AOT': IS_PRODUCTION
}),

new ForkCheckerPlugin()
Expand Down
6 changes: 4 additions & 2 deletions build/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ module.exports = {
},

module: {
loaders: [{
exprContextCritical: false,
rules: [{
enforce: 'pre',
test: /\.js$/,
loader: 'source-map-loader',
Expand Down Expand Up @@ -84,7 +85,8 @@ module.exports = {
new webpack.BannerPlugin(BANNER),
new webpack.DefinePlugin({
'IS_PRODUCTION': true,
'LIB_VERSION': VERSION
'LIB_VERSION': VERSION,
'AOT': true
})
],
}
19 changes: 10 additions & 9 deletions build/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = {
resolve: {
extensions: ['.ts', '.js', '.json', '.css'],
alias: {
'./lib/bootstrap': root('lib/bootstrap.dev'),
http: 'stream-http',
https: 'stream-http'
}
Expand All @@ -37,6 +36,7 @@ module.exports = {
},

module: {
exprContextCritical: false,
rules: [{
enforce: 'pre',
test: /\.js$/,
Expand All @@ -56,13 +56,13 @@ module.exports = {
],
exclude: [/\.(spec|e2e)\.ts$/]
}, {
test: /lib\/.*\.css$/,
test: /lib[\\\/].*\.css$/,
loaders: ['raw-loader'],
exclude: [/redoc-initial-styles\.css$/]
}, {
test: /\.css$/,
loaders: ['style', 'css?-import'],
exclude: [/lib\/(?!.*redoc-initial-styles).*\.css$/]
exclude: [/lib[\\\/](?!.*redoc-initial-styles).*\.css$/]
}, {
test: /\.html$/,
loader: 'raw-loader'
Expand All @@ -86,7 +86,8 @@ module.exports = {
plugins: [
new webpack.DefinePlugin({
'IS_PRODUCTION': false,
'LIB_VERSION': VERSION
'LIB_VERSION': VERSION,
'AOT': 'false'
}),
new webpack.LoaderOptionsPlugin({
test: /\.ts$/,
Expand All @@ -97,11 +98,11 @@ module.exports = {
}),
// ignore changes during tests
new webpack.WatchIgnorePlugin([
/\/ReDoc$/i, // ignore change of ReDoc folder itself
/node_modules\/(?:[^\/]*(?:\/|$))*[^\/]*$/,
/\.tmp\/(?:[^\/]*(?:\/|$))*[^\/]*$/,
/dist\/(?:[^\/]*(?:\/|$))*[^\/]*$/,
/(?:[^\/]*(?:\/|$))*[^\/]*\.css$/ // ignore css files
/[\\\/]ReDoc$/i, // ignore change of ReDoc folder itself
/node_modules[\\\/].*$/,
/\.tmp[\\\/].*$/,
/dist[\\\/].*$/,
/(?:[^\\\/]*(?:[\\\/]|$))*[^\\\/]*\.css$/ // ignore css files
])
],
}
8 changes: 7 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import { Redoc } from './components/index';
import { SpecManager } from './utils/SpecManager';
import { BrowserDomAdapter as DOM } from './utils/browser-adapter';
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) {
disableDebugTools();
Expand Down
1 change: 1 addition & 0 deletions manual-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ declare module "*.css" {

declare var LIB_VERSION: any;
declare var IS_PRODUCTION: any;
declare var AOT: any;

interface ErrorStackTraceLimit {
stackTraceLimit: number;
Expand Down

0 comments on commit 79693e1

Please sign in to comment.