我有业力预处理器
'preprocessors: {
'./spec/tests.webpack.js': ['webpack','sourcemap']
},
reporters: ['coverage-istanbul'],
singleRun: true,
webpack: webpackConfig'
我的webpackConfig devtool
为inline-source-map
。即使我从karma预处理器中删除源图,我仍然能够看到映射的源文件。业力源图预处理器究竟做了什么?
这是我完整的业力配置
var webpack = require('webpack');
var path = require('path');
var chai = require('chai')
var chaiAspromised = require('chai-as-promised')
var sinonChai = require('sinon-chai')
var webpackConfig = require('../webpack.config');
module.exports = function(config) {
config.set({
browsers: ['PhantomJS'],
files: [
'./spec/tests.webpack.js',
'./../node_modules/sinon/pkg/sinon.js'
],
frameworks: ['jasmine','chai'],
preprocessors: {
'./spec/tests.webpack.js': ['webpack','sourcemap']
},
reporters: ['coverage-istanbul'],
singleRun: true,
webpack: webpackConfig,
webpackServer: {
noInfo: true,
}
});
};
我的webpack配置
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: './app/bootstrapper.js',
output: {
path: __dirname + '/dist',
filename: 'bundle.js',
library: 'EntryPoint'
},
module: {
rules:
[
// {
// test: /\.js$/,
// exclude: /\.test.js$|\.spec.js$|node_modules/,
// use: [
// 'babel-loader',
// {
// loader: 'istanbul-instrumenter-loader',
// options: {
// esModules: true
// }
// }
// ]
// },
// {
// test: /\.js$/,
// exclude: /node_modules/,
// loader: 'babel-loader'
// },
{
test: /\.js$/,
loader: 'ng-annotate-loader?add=true!babel-loader',
exclude: /node_modules/
},
{
test: /.html$/,
loader: 'ngtemplate-loader?relativeTo=' + __dirname +'/app!html?
root=' + __dirname + '/app'
},
{
test: /\.scss$/,
use: [{loader: 'style-loader'},{loader: 'css-loader?root=' +
__dirname + '/app'},{loader: 'sass-loader'},{loader: 'autoprefixer-
loader?browsers=last 2 versions'}]
},
{
test: /\.css$/, loader: 'style-loader!css-loader'
},
{
test: /\.(png|woff|woff2|eot|ttf|svg|gif)$/, loader: 'url-
loader?limit=100000'
},
{
test: /\.png$/,
loader: 'file-loader'
}]
},
plugins: [
// new webpack.optimize.UglifyJsPlugin({ minimize: true, output: {
comments: false }}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
})
],
resolve: {
modules: [path.resolve('app/'),
path.resolve('node_modules/')]
},
devtool: 'inline-source-map'
};