forked from LD4P/sinopia_editor
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
99 lines (97 loc) · 2.15 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
91
92
93
94
95
96
97
98
99
// Copyright 2019 Stanford University see LICENSE for license
/* eslint node/no-unpublished-require: ["off"] */
const path = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
entry: './src/index.js',
module: {
noParse: /bad_json/,
rules: [
{
test: /\.(js|jsx)$/,
include: path.resolve(__dirname, './src'),
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.s[ac]ss$/i,
use: [
// Creates `style` nodes from JS strings
'style-loader',
// Translates CSS into CommonJS
'css-loader',
// Compiles Sass to CSS
'sass-loader',
],
},
{
test: /\.(png|jpg|gif)$/,
use: [
'file-loader',
],
},
{
parser: {
amd: false,
},
},
],
},
node: {
fs: 'empty',
},
resolve: {
extensions: ['*', '.js', '.jsx'],
},
output: {
path: path.join(__dirname, '/dist'),
publicPath: '/dist/',
filename: 'bundle.js',
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jquery: 'jQuery',
'window.jQuery': 'jquery',
'window.$': 'jquery',
}),
new webpack.HotModuleReplacementPlugin(),
new HtmlWebpackPlugin({
template: path.resolve('./', 'index.html'),
filename: 'index.html',
hash: true,
}),
new webpack.EnvironmentPlugin(
[
'USE_FIXTURES',
'TRELLIS_BASE_URL',
'DEFAULT_PROFILE_SCHEMA_VERSION',
'SINOPIA_GROUP',
'SINOPIA_ENV',
'SINOPIA_URI',
'AWS_COGNITO_DOMAIN',
'COGNITO_CLIENT_ID',
'COGNITO_USER_POOL_ID',
'INDEX_URL',
'SEARCH_HOST',
'EXPORT_BUCKET_URL',
'HONEYBADGER_API_KEY',
'HONEYBADGER_REVISION',
],
),
],
devtool: 'source-map',
devServer: {
historyApiFallback: true,
hot: true,
port: 8888,
proxy: {
'/api/search': 'http://localhost:8000',
},
},
}