forked from accordproject/template-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.prod.js
More file actions
73 lines (70 loc) · 1.59 KB
/
webpack.config.prod.js
File metadata and controls
73 lines (70 loc) · 1.59 KB
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
var path = require('path');
var webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ROOT_URI = 'https://studio.accordproject.org'; // No end '/' please
function resolveRootURI() {
if (process.env.CONTEXT === 'production') {
return ROOT_URI;
} else {
return process.env.DEPLOY_PRIME_URL || ROOT_URI;
}
}
module.exports = {
entry: {
client: [
'./src/index.js'
]
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].bundle.js',
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.html'
}),
new CopyWebpackPlugin([
{ from: 'static', to: 'static' }
]),
new webpack.DefinePlugin({
ROOT_URI: JSON.stringify(resolveRootURI()), // From Netlify
}),
new webpack.IgnorePlugin(/jsdom$/),
],
module: {
rules: [
{
test: /\.js$/,
include: [path.join(__dirname, 'src')],
use: ['babel-loader']
},
{
test: /\.js$/,
include: [/node_modules/],
use: ['shebang-loader']
},
{
test: /\.(ne|cta)$/,
use:['raw-loader']
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.styl$/,
use: ['style-loader', 'css-loader', 'stylus-loader']
},
]
},
resolveLoader: {
modules: ['node_modules', path.resolve(__dirname, 'src/loaders/')],
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty'
}
};