Skip to content

Commit f910cb3

Browse files
include eollup plugins
1 parent 055a67d commit f910cb3

File tree

3 files changed

+770
-13
lines changed

3 files changed

+770
-13
lines changed

functions/gen-opengraph-image/package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,21 @@
88
"@emotion/core": "^10.0.28",
99
"playwright-aws-lambda": "^0.4.0",
1010
"playwright-core": "^0.11.1",
11+
"react": "^16.13.0",
12+
"react-dom": "^16.13.0",
1113
"react-textfit": "^1.1.0"
1214
},
1315
"devDependencies": {
1416
"@babel/core": "^7.8.7",
1517
"@babel/preset-env": "^7.8.7",
1618
"@babel/preset-react": "^7.8.3",
19+
"@rollup/plugin-commonjs": "^11.0.2",
20+
"@rollup/plugin-node-resolve": "^7.1.1",
21+
"@rollup/plugin-replace": "^2.3.1",
1722
"rollup": "^2.1.0",
18-
"rollup-plugin-babel": "^4.4.0"
23+
"rollup-plugin-babel": "^4.4.0",
24+
"rollup-plugin-node-builtins": "^2.1.2",
25+
"rollup-plugin-node-globals": "^1.4.0"
1926
},
2027
"scripts": {
2128
"build": "rollup -c rollup.config.js"
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,39 @@
11
import babel from "rollup-plugin-babel";
2+
import resolve from "@rollup/plugin-node-resolve";
3+
import commonjs from "@rollup/plugin-commonjs";
4+
import builtins from "rollup-plugin-node-builtins";
5+
import globals from "rollup-plugin-node-globals";
6+
import replace from "@rollup/plugin-replace";
7+
import React from "react";
8+
import ReactDOM from "react-dom";
29

310
const config = {
411
input: "src/image.js",
512
output: [
613
{
714
file: `image.js`,
8-
format: "cjs"
15+
format: "iife"
916
}
1017
],
11-
plugins: [babel()]
18+
plugins: [
19+
resolve({
20+
preferBuiltins: true
21+
}),
22+
babel({
23+
exclude: "node_modules/**"
24+
}),
25+
commonjs({
26+
namedExports: {
27+
"react-dom": Object.keys(ReactDOM),
28+
react: Object.keys(React)
29+
}
30+
}),
31+
replace({
32+
"process.env.NODE_ENV": JSON.stringify("production")
33+
}),
34+
globals(),
35+
builtins()
36+
]
1237
};
1338

1439
export default config;

0 commit comments

Comments
 (0)