forked from MurhafSousli/ngx-sharebuttons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(config): update config files (migrate to webpack 2 + improve ka…
…rma config) - add option to deactivate code coverage (useful for debugging tests) - add new gulp task `test:watch-no-cc` that runs tests in watch without coverage - ping `codelyzer` version to 1.0.0-beta.0 (for compatibility with angular 2.0.0)
- Loading branch information
Showing
5 changed files
with
158 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,114 @@ | ||
var helpers = require('./helpers'); | ||
const helpers = require('./helpers'); | ||
const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin'); | ||
const {CheckerPlugin} = require('awesome-typescript-loader'); | ||
|
||
module.exports = { | ||
devtool: 'inline-source-map', | ||
const getConfig = (hasCoverage, isTddMode) => { | ||
|
||
resolve: { | ||
extensions: ['', '.ts', '.js'], | ||
root: helpers.root('src') | ||
}, | ||
|
||
module: { | ||
preLoaders: [ | ||
{ | ||
test: /\.js$/, | ||
loader: 'source-map-loader', | ||
exclude: [ | ||
helpers.root('node_modules', 'rxjs'), | ||
helpers.root('node_modules', '@angular') | ||
] | ||
} | ||
], | ||
loaders: [ | ||
{ | ||
test: /\.ts$/, | ||
loaders: ['awesome-typescript-loader', 'angular2-template-loader'] | ||
}, | ||
{ | ||
test: /\.html$/, | ||
loader: 'html' | ||
|
||
}, | ||
let extraRules = []; | ||
if (hasCoverage) { | ||
extraRules.push( | ||
{ | ||
test: /\.css$/, | ||
exclude: helpers.root('src'), | ||
loader: 'null' | ||
}, | ||
{ | ||
test: /\.css$/, | ||
enforce: 'post', | ||
test: /\.(js|ts)$/, | ||
loader: 'istanbul-instrumenter-loader', | ||
include: helpers.root('src'), | ||
loader: 'raw' | ||
} | ||
], | ||
postLoaders: [ | ||
{ | ||
test: /\.(js|ts)$/, loader: 'sourcemap-istanbul-instrumenter-loader', | ||
exclude: [ | ||
/\.(e2e|spec)\.ts$/, | ||
/node_modules/ | ||
], | ||
query: { 'force-sourcemap': true } | ||
] | ||
} | ||
] | ||
); | ||
} | ||
|
||
let extraPlugins = []; | ||
if (isTddMode) { | ||
extraPlugins.push(new CheckerPlugin());//to speed up compilation during TDD | ||
} | ||
|
||
return { | ||
|
||
devtool: 'inline-source-map', | ||
|
||
resolve: { | ||
extensions: ['.ts', '.js'], | ||
modules: [helpers.root('src'), 'node_modules'] | ||
|
||
}, | ||
|
||
module: { | ||
|
||
rules: [ | ||
|
||
{ | ||
enforce: 'pre', | ||
test: /\.js$/, | ||
loader: 'source-map-loader', | ||
exclude: [ | ||
// these packages have problems with their sourcemaps | ||
helpers.root('node_modules/rxjs'), | ||
helpers.root('node_modules/@angular') | ||
] | ||
}, | ||
|
||
{ | ||
test: /\.ts$/, | ||
use: [ | ||
{ | ||
loader: 'awesome-typescript-loader', | ||
query: { | ||
// use inline sourcemaps for "karma-remap-coverage" reporter (if coverage is activated) | ||
sourceMap: !hasCoverage, | ||
inlineSourceMap: hasCoverage, | ||
compilerOptions: { | ||
|
||
// Remove TypeScript helpers to be injected | ||
// below by DefinePlugin | ||
removeComments: true | ||
|
||
} | ||
}, | ||
}, | ||
'angular2-template-loader' | ||
], | ||
exclude: [/\.e2e\.ts$/] | ||
}, | ||
|
||
|
||
{ | ||
test: /\.css$/, | ||
loader: ['to-string-loader', 'css-loader'] | ||
}, | ||
|
||
{ | ||
test: /\.html$/, | ||
loader: 'raw-loader' | ||
} | ||
].concat(extraRules) | ||
}, | ||
|
||
plugins: [ | ||
|
||
new LoaderOptionsPlugin({ | ||
debug: false, | ||
options: { | ||
// legacy options go here | ||
} | ||
}) | ||
].concat(extraPlugins), | ||
|
||
performance: { | ||
hints: false | ||
}, | ||
|
||
node: { | ||
global: true, | ||
process: false, | ||
crypto: 'empty', | ||
module: false, | ||
clearImmediate: false, | ||
setImmediate: false | ||
} | ||
}; | ||
} | ||
|
||
module.exports.getConfig = getConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters