Created
March 1, 2021 04:22
-
-
Save theoparis/1657c3b99a806edd55900da3cc02fe36 to your computer and use it in GitHub Desktop.
rollup preact + typescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import typescript from "@rollup/plugin-typescript"; | |
import resolve from "@rollup/plugin-node-resolve"; | |
import commonjs from "@rollup/plugin-commonjs"; | |
import html from "@rollup/plugin-html"; | |
import serve from "rollup-plugin-serve"; | |
import replace from "@rollup/plugin-replace"; | |
import jsx from "acorn-jsx"; | |
import alias from "@rollup/plugin-alias"; | |
export default { | |
input: "./src/index.tsx", | |
output: { | |
file: "./dist/bundle.js", | |
format: "iife", | |
globals: { | |
react: "React", | |
"react-dom": "ReactDOM", | |
}, | |
}, | |
acornInjectPlugins: [jsx()], | |
plugins: [ | |
replace({ | |
preventAssignment: true, | |
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV), | |
}), | |
alias({ | |
entries: [ | |
{ find: "react", replacement: "preact/compat" }, | |
{ find: "react-dom", replacement: "preact/compat" }, | |
], | |
}), | |
resolve(), | |
commonjs(), | |
typescript(), | |
html(), | |
serve("dist"), | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment