Skip to content

Commit a7bd94a

Browse files
build: bundle assets inline for the component library (#513)
* build: bundle assets inline for the component library * chore(deps): allow react version 17.x.x and 18.x.x
1 parent 1be5cbd commit a7bd94a

4 files changed

Lines changed: 42 additions & 22 deletions

File tree

.depcheckrc.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"crypto*",
1515
"stream*",
1616
"env-paths",
17-
"open"
17+
"open",
18+
"base64-inline-loader"
1819
]
19-
}
20+
}

package-lock.json

Lines changed: 30 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
"notistack": "1.0.10",
5151
"opener": "1.5.2",
5252
"qrcode.react": "1.0.1",
53-
"react": ">= 17.0.2",
53+
"react": ">=17.0.0 || >=18.0.0",
5454
"react-copy-to-clipboard": "5.0.4",
55-
"react-dom": ">= 17.0.2",
55+
"react-dom": ">=17.0.0 || >=18.0.0",
5656
"react-identicons": "1.2.5",
5757
"react-router": "6.2.1",
5858
"react-router-dom": "6.2.1",
@@ -92,6 +92,7 @@
9292
"babel-loader": "8.1.0",
9393
"babel-plugin-syntax-dynamic-import": "6.18.0",
9494
"babel-plugin-tsconfig-paths": "1.0.2",
95+
"base64-inline-loader": "^2.0.1",
9596
"cors": "^2.8.5",
9697
"depcheck": "^1.4.3",
9798
"env-paths": "^3.0.0",
@@ -112,6 +113,7 @@
112113
"prettier": "2.4.1",
113114
"puppeteer": "^15.4.0",
114115
"react-scripts": "^5.0.1",
116+
"rimraf": "^3.0.2",
115117
"ts-node": "^10.8.1",
116118
"typescript": "4.7.3",
117119
"web-vitals": "2.1.2",
@@ -127,7 +129,7 @@
127129
"start": "react-scripts start",
128130
"desktop": "node ./desktop.mjs",
129131
"build": "react-scripts build",
130-
"build:component": "webpack --mode=production",
132+
"build:component": "rimraf ./lib && webpack --mode=production",
131133
"compile:types": "tsc --project tsconfig.lib.json --emitDeclarationOnly --declaration",
132134
"test": "react-scripts test",
133135
"test:ui": "node ui-test/index.js",
@@ -160,4 +162,4 @@
160162
"npm": ">=6.9.0",
161163
"bee": ">=0.6.0"
162164
}
163-
}
165+
}

webpack.config.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,9 @@ module.exports = () => {
3535
use: ['style-loader', 'css-loader'],
3636
},
3737
{
38-
test: /\.(png|jp(e*)g|svg|gif)$/,
39-
loader: 'file-loader',
40-
options: {
41-
name: 'assets/[name].[ext]',
42-
},
43-
},
44-
{
45-
test: /\.(ttf)$/,
46-
loader: 'file-loader',
47-
options: {
48-
name: 'assets/fonts/[name].[ext]',
49-
},
38+
test: /\.(jpe?g|png|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
39+
use: ['base64-inline-loader'],
40+
type: 'javascript/auto'
5041
},
5142
{
5243
test: /\.(ts|js|tsx|jsx)$/,

0 commit comments

Comments
 (0)