Skip to content

Commit 5ff17fd

Browse files
authored
Added build targeting esm module (#659)
1 parent 363690a commit 5ff17fd

File tree

3 files changed

+217
-1
lines changed

3 files changed

+217
-1
lines changed

package-lock.json

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

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"jsdelivr": "dist/tesseract.min.js",
99
"scripts": {
1010
"start": "node scripts/server.js",
11-
"build": "rimraf dist && webpack --config scripts/webpack.config.prod.js",
11+
"build": "rimraf dist && webpack --config scripts/webpack.config.prod.js && rollup -c scripts/rollup.esm.js",
1212
"profile:tesseract": "webpack-bundle-analyzer dist/tesseract-stats.json",
1313
"profile:worker": "webpack-bundle-analyzer dist/worker-stats.json",
1414
"prepublishOnly": "npm run build",
@@ -37,6 +37,7 @@
3737
"devDependencies": {
3838
"@babel/core": "^7.18.7",
3939
"@babel/preset-env": "^7.18.7",
40+
"@rollup/plugin-commonjs": "^22.0.2",
4041
"acorn": "^6.4.0",
4142
"babel-loader": "^8.2.0",
4243
"buffer": "^6.0.3",
@@ -51,6 +52,7 @@
5152
"npm-run-all": "^4.1.5",
5253
"nyc": "^15.1.0",
5354
"rimraf": "^2.7.1",
55+
"rollup": "^2.79.0",
5456
"wait-on": "^3.3.0",
5557
"webpack": "^5.74.0",
5658
"webpack-bundle-analyzer": "^4.6.0",

scripts/rollup.esm.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import commonjs from "@rollup/plugin-commonjs";
2+
3+
export default [
4+
{
5+
input: "dist/tesseract.min.js",
6+
output: {
7+
file: "dist/tesseract.esm.min.js",
8+
format: "esm",
9+
banner: "/* eslint-disable */",
10+
},
11+
plugins: [commonjs()],
12+
},
13+
];

0 commit comments

Comments
 (0)