-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
90 lines (89 loc) · 2.16 KB
/
webpack.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
var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: [
"@babel/polyfill",
"./src/index.js"
],
output: {
filename: "[name].js",
path: path.resolve(__dirname, 'app'),
},
mode: "none",
resolve: {
alias: { // Allows absolute paths in import statements, so we can `import Example from '@store/Example'` instead of `import Example from '../../src/store/Example'`
'@util': path.resolve(__dirname, 'src/util/'),
'@store': path.resolve(__dirname, 'src/store/'),
'@config': path.resolve(__dirname, 'src/config/'),
'@demo-data': path.resolve(__dirname, 'src/demo-data/'),
'@assets': path.resolve(__dirname, 'assets/'),
},
fallback: {
fs: false,
url: require.resolve("url"),
process: false,
}
},
plugins: [
new webpack.EnvironmentPlugin({
DEBUG: false,
NODE_ENV: 'development',
REACT_APP_ENV: false,
PANOPTES_ENV: 'staging',
PANOPTES_API_HOST: false,
PANOPTES_API_APPLICATION: false,
PROXY_HOST: false,
TALK_HOST: false,
SUGAR_HOST: false,
STAT_HOST: false,
OAUTH_HOST: false,
})
],
module: {
rules: [
{ // Compile JavaScript files into a single bundle
test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader"
},
{ // Compile Sass assets
test: /\.(scss)$/,
use: [
'style-loader',
'css-loader',
'sass-loader',
],
},
{ // Copy HTML file
test: /\.html$/,
type: 'asset/resource',
generator: {
filename: '[name][ext]'
}
},
{ // Copy media assets
test: /\.(png|jpe?g|gif)$/,
type: 'asset/resource',
generator: {
filename: 'assets/[name][ext]'
}
},
{ // Copy demo data
test: /demo-data\/.+\.txt/,
type: 'asset/resource',
generator: {
filename: 'demo-data/[name][ext]'
}
},
],
},
devServer: {
allowedHosts: [
'localhost',
'.zooniverse.org'
],
historyApiFallback: true,
port: 3000,
server: 'https',
},
}