forked from JetBrains/ring-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack-test.config.js
57 lines (45 loc) · 1.27 KB
/
webpack-test.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const path = require('path');
const webpack = require('webpack');
const config = require('./webpack.config').config;
const loaders = require('./webpack.config').loaders;
const helpersPath = path.join(__dirname, 'test-helpers');
loaders.babelLoader.include.push(helpersPath);
config.module.rules.push({
test: /\.js$/,
include: path.join(__dirname, 'node_modules/chai-as-promised'),
use: {
loader: 'babel-loader',
options: {
presets: ['@jetbrains/jetbrains'],
babelrc: false
}
}
});
config.resolve = {
alias: {
'@jetbrains/ring-ui': __dirname
}
};
config.output = {
devtoolModuleFilenameTemplate: '/[absolute-resource-path]' // For some reason slash in the beginning is required
};
config.devtool = 'source-map';
config.plugins = [
new webpack.ProvidePlugin({
fetch: '!exports-loader?self.fetch!imports-loader' +
'?self=>{},Promise=core-js/es6/promise!whatwg-fetch'
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"development"'
}
})
];
// this addresses internal `require`s in enzyme used for environment detection
config.externals = {
'react/addons': 'react',
'react/lib/ExecutionEnvironment': 'react',
'react/lib/ReactContext': 'react',
'react-addons-test-utils': 'window'
};
module.exports = config;