forked from positive-intentions/frontend-base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
76 lines (72 loc) · 2.28 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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { ModuleFederationPlugin } = require('webpack').container;
const WebpackPwaManifest = require('webpack-pwa-manifest');
const path = require('path');
module.exports = {
mode: 'development',
entry: './src/index.ts',
output: {
filename: 'main.js',
path: __dirname + '/dist',
publicPath: 'auto',
},
module: {
rules: [
{
test: /\.(js|ts|jsx|tsx)$/,
loader: "babel-loader",
exclude: /node_modules/,
options: {
presets: ["@babel/preset-react"],
},
},
// css and scss loader
{
// test: /\.css$/,
test: /\.(css|scss)$/,
use: ["style-loader", "css-loader"],
},
// image loader
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
}),
new WebpackPwaManifest({
filename: "manifest.json",
name: 'positive-intentions',
short_name: 'PI',
description: 'positive-intentions',
"icons": [
{
src: path.resolve('./public/favicon.ico'),
sizes: [96] // multiple sizes
},
{
src: path.resolve('./public/logo512.png'),
sizes: [96, 128, 192, 256, 384, 512], // multiple sizes
maskable: true,
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#44b700",
"background_color": "#ffffff",
// crossorigin: 'use-credentials', // can be null, use-credentials or anonymous
inject: true,
}),
new ModuleFederationPlugin({
name: 'frontendBase',
filename: 'remoteEntry.js',
exposes: {
'./Example': './src/stories/components/Example.tsx',
},
shared: { react: { singleton: true }, "react-dom": { singleton: true } }
}),
],
};