Created
April 18, 2016 09:16
-
-
Save b1ff/80cd3edaaa354afab72c536679daabd4 to your computer and use it in GitHub Desktop.
Webpack configuration for unit-tests using Jasmine and Enzyme.
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
'use strict'; | |
const webpack = require('webpack'); | |
let path = require('path'); | |
let srcPath = path.join(__dirname, '/../src/'); | |
let baseConfig = require('./base'); | |
module.exports = { | |
devtool: 'inline-source-map', | |
module: { | |
preLoaders: [ | |
{ | |
test: /\.(js|jsx)$/, | |
loader: 'isparta-instrumenter-loader', | |
include: [ | |
path.join(__dirname, '/../src') | |
] | |
} | |
], | |
loaders: [ | |
{ | |
test: /\.(png|jpg|gif|woff|woff2|css|sass|scss|less|styl)$/, | |
loader: 'null-loader' | |
}, | |
{ | |
test: /\.(js|jsx)$/, | |
loader: 'babel-loader', | |
include: [].concat( | |
baseConfig.additionalPaths, | |
[ | |
path.join(__dirname, '/../src'), | |
path.join(__dirname, '/../test') | |
] | |
) | |
} | |
] | |
}, | |
externals: { | |
'cheerio': 'window', | |
'react/lib/ExecutionEnvironment': true, | |
'react/lib/ReactContext': true | |
}, | |
resolve: { | |
extensions: ['', '.js', '.jsx'], | |
alias: { | |
helpers: path.join(__dirname, '/../test/helpers'), | |
components: srcPath + 'components/', | |
config: srcPath + 'config/' + process.env.REACT_WEBPACK_ENV | |
} | |
}, | |
plugins: [ | |
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment