forked from Bahmni/implementer-interface
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.test.config.js
104 lines (102 loc) · 2.5 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const srcPath = path.join(__dirname, './src');
const testPath = path.join(__dirname, './test');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
devtool: 'cheap-module-source-map',
entry: [
'./src/index.js',
'./styles/styles.scss',
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/implementer-interface/',
},
devServer: {
inline: true,
headers: { 'Access-Control-Allow-Origin': '*' },
contentBase: './dist',
proxy: {
'/openmrs': {
target: 'https://192.168.33.10',
secure: false,
},
'/bahmni': {
target: 'https://192.168.33.10',
secure: false,
},
},
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin('styles.css', { allChunks: true }),
new CopyWebpackPlugin([
{
from: path.join(__dirname, 'styles/fonts'), to: path.join(__dirname, '../dist/fonts'),
},
], { copyUnmodified: true }
),
],
externals: {
'react/lib/ExecutionEnvironment': true,
'react/lib/ReactContext': true,
'react/addons': true,
},
module: {
loaders: [
{
test: /\.(js|jsx)$/,
loaders: ['babel'],
include: path.join(__dirname, 'src'),
},
{
test: /\.js$/,
loaders: ['babel-loader'],
include: path.join(__dirname, 'test'),
},
{
test: /\.json$/,
loader: 'json',
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('css!sass'),
},
{
test: /\.css$/,
loader: 'style-loader!css-loader',
},
// the url-loader uses DataUrls.
// the file-loader emits files.
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff',
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'file-loader?name=/styles/images/[name].[ext]',
},
],
preLoaders: [
{
test: /\.(js|jsx)$/,
include: path.join(__dirname, 'src'),
loader: 'isparta',
},
],
},
resolve: {
alias: {
common: `${srcPath}/common/`,
'form-builder': `${srcPath}/form-builder/`,
test: testPath,
},
},
};