-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.js
109 lines (107 loc) · 2.82 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
100
101
102
103
104
105
106
107
108
109
var webpack = require("webpack");
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const outputDir = path.join(__dirname, "build/");
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
const isProd = process.env.NODE_ENV === "production";
var catala = {
entry: "./src/Index.bs.js",
mode: isProd ? "production" : "development",
resolve: {
alias: {
fs: "browserfs/dist/shims/fs.js",
buffer: "browserfs/dist/shims/buffer.js",
path: "browserfs/dist/shims/path.js",
processGlobal: "browserfs/dist/shims/process.js",
bufferGlobal: "browserfs/dist/shims/bufferGlobal.js",
bfsGlobal: require.resolve("browserfs"),
child_process: "browser-builtins/builtin/child_process.js",
},
fallback: {
constants: require.resolve("constants-browserify"),
tty: false,
},
},
devtool: "source-map",
output: {
path: outputDir,
filename: "Index.js",
publicPath: "/",
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
template: "src/index.html",
}),
new FaviconsWebpackPlugin({
logo: "./assets/logo.png",
mode: "webapp", // optional can be 'webapp' or 'light' - 'webapp' by default
devMode: "webapp", // optional can be 'webapp' or 'light' - 'light' by default
inject: true,
favicons: {
appName: "Catala",
icons: {
coast: false,
yandex: false,
},
},
}),
// Expose BrowserFS, process, and Buffer globals.
// NOTE: If you intend to use BrowserFS in a script tag, you do not need
// to expose a BrowserFS global.
new webpack.ProvidePlugin({
BrowserFS: "bfsGlobal",
process: "processGlobal",
Buffer: "bufferGlobal",
}),
],
devServer: {
compress: true,
static: outputDir,
port: process.env.PORT || 8000,
historyApiFallback: true,
},
module: {
noParse: /browserfs\.js/,
rules: [
{
test: /\.schema.jsx$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
presets: [
"@babel/preset-env",
["@babel/preset-react", { runtime: "automatic" }],
],
},
},
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.html$/,
loader: "html-loader",
options: {
esModule: false,
},
},
{
test: /\.catala_en/,
use: ["raw-loader"],
},
{
test: /\.catala_fr/,
use: ["raw-loader"],
},
{
test: /\.(png|svg|jpg|gif)$/,
use: ["file-loader?name=assets/[name].[ext]"],
},
],
},
};
module.exports = catala;