This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.config.js
100 lines (97 loc) · 2.92 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
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const Path = require("path");
var env = process.env.ENV || "local";
const isDevEnv = /^(local|dev|develop)$/gi.test(env);
const sourceMapOptions = isDevEnv ? "eval-cheap-module-source-map" : false;
var config = [
{
entry: {
bundle: "./client/app.js",
},
devtool: sourceMapOptions,
output: {
filename: "[name].js",
path: __dirname + "/dist",
libraryTarget: "umd",
library: "hyperion",
globalObject: "this",
},
mode: "development",
externals: {
three: "THREE",
react: "react",
"react-dom": "react-dom",
},
resolve: {
alias: {
PIXI: Path.resolve(__dirname, "node_modules/pixi.js/"),
},
},
module: {
rules: [
{
test: /.jsx?$/,
loader: "babel-loader",
exclude: Path.resolve(__dirname, "node_modules"),
options: {
presets: ["@babel/react", ["@babel/env", { "targets": "defaults" }]],
plugins: ["@babel/plugin-transform-spread"]
},
},
{
test: /\.(css|sass|scss)$/,
use: [
{
loader: "css-loader",
},
{
loader: "sass-loader",
},
],
},
{
test: /\.svg$/i,
use: {
loader: "svg-url-loader",
options: {
// loader behaves like url-loader for all svg files
encoding: "base64",
},
},
},
],
},
},
{
entry: ["./node_modules/react-dates/lib/css/_datepicker.css", "./scss/components.scss"],
output: {
path: __dirname + "/dist",
libraryTarget: "umd",
library: "hyperion",
globalObject: "this",
},
mode: "development",
module: {
rules: [
{
test: /\.(css|sass|scss)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
},
{
loader: "sass-loader",
},
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].bundle.css"
}),
],
},
];
module.exports = config;