-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
66 lines (65 loc) · 2.05 KB
/
webpack.config.js
File metadata and controls
66 lines (65 loc) · 2.05 KB
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
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: { //all these files are individually accessible by the applications making use of this library
DraftsClient: './src/DraftsClient.jsx',
LoginClient: './src/LoginClient.jsx',
PostClient: './src/PostClient.jsx',
},
performance: {
hints: false
},
module: {
rules: [
{
test: /\.jsx?$/, // Matches both .js and .jsx files
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.css$/i,
include: path.resolve(__dirname, 'src'),
use: ['style-loader', 'css-loader', 'postcss-loader'],
},
{
test: /\.scss$/i,
include: path.resolve(__dirname, 'src'),
use: ['style-loader', 'css-loader', 'sass-loader'],
},
]
},
output: {
path: path.resolve(__dirname, 'dist'),
},
mode: 'production', //change to development when developing
// mode: 'development', //change to production when exporting
experiments: {
topLevelAwait: true
},
devServer: { //used by npm run serve
static: {
directory: path.join(__dirname, 'dist'),
},
compress: true,
port: 9000,
headers: {
"Access-Control-Allow-Origin": "*",
}
},
//replace __JS_PACKAGE_HOST__ strings with the host of this package with the DefinePlugin
plugins: [
new webpack.DefinePlugin({
// __JS_PACKAGE_HOST__: JSON.stringify("http://localhost:9000") //for local development
__JS_PACKAGE_HOST__: JSON.stringify("https://penmark.appsinprogress.com/dist") //for production
}),
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
],
resolve: {
extensions: [ '.ts', '.js', '.jsx'],
fallback: {
"buffer": require.resolve("buffer")
}
},
};