-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack_dev.config.js
119 lines (119 loc) · 3.15 KB
/
webpack_dev.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
110
111
112
113
114
115
116
117
118
119
const path = require('path')
const webpack = require('webpack')
const Dotenv = require('dotenv-webpack')
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
mode: 'development',
context: __dirname,
//devtool: 'inline-source-map',
devtool: 'source-map',
entry: [
'./src/index.js',
],
output: {
path: path.resolve(__dirname, 'dev'),
filename: 'bundle.js',
},
devServer: {
compress: true,
historyApiFallback: true,
port: 3030
},
plugins: [
new HtmlWebPackPlugin({
inject: true,
template: path.resolve(__dirname, './index.html'),
bundleFileName:"bundle.js"
}),
new Dotenv({path: path.resolve(__dirname, '.env'), systemvars: true}),
new webpack.LoaderOptionsPlugin({
debug: true
})
],
resolve: {
alias: {
//"@terminusdb/terminusdb-client": path.resolve('../terminusdb-client/index.js'),
//"@rjsf/core": path.resolve('../react-jsonschema-form/packages/core/src/index.js'),
"@terminusdb/terminusdb-documents-ui": path.resolve('../terminusdb-documents-ui/src/index.js'),
//"@terminusdb-live/terminusdb-react-table": path.resolve('../terminusdb-react-table/src/index.js'),
react: path.resolve('./node_modules/react')
},
fallback: { "https": false },
extensions: ['.js', '.jsx', '.json'],
},
module: {
rules : [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader:"babel-loader",
options:{
sourceType: "unambiguous",
presets: [
["@babel/preset-env"],
"@babel/preset-react"
],
plugins: [[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],"@babel/plugin-transform-react-jsx",
"@babel/plugin-proposal-export-default-from","@babel/plugin-transform-regenerator",
["@babel/plugin-transform-runtime"]
]
}
},
},
{
test: /\.(css|less)$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: 'less-loader',
options: {
sourceMap: true,
},
},
],
},
{
test: /\.(svg|jpg|gif|png)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[name].[ext]',
//outputPath: "images",
//publicPath: "images"
}
}
]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
{
loader: 'file-loader',
options: {
outputPath: (url, resourcePath, context) => {
//if(argv.mode === 'development') {
const relativePath = path.relative(context, resourcePath);
return `/${relativePath}`;
//}
//return `/assets/fonts/${path.basename(resourcePath)}`;
}
}
}
]
}
]
}
}