|
@@ -4,11 +4,7 @@ import pluginJson from "@rollup/plugin-json";
|
|
|
import pluginHtml from "rollup-plugin-html";
|
|
|
import pluginCss from "rollup-plugin-import-css";
|
|
|
import pluginMarkdown from "@jackfranklin/rollup-plugin-markdown";
|
|
|
-import pluginReplace from "@rollup/plugin-replace";
|
|
|
-import pluginCJS from "rollup-plugin-commonjs";
|
|
|
-import pluginBabel from "@rollup/plugin-babel";
|
|
|
import pluginExecute from "rollup-plugin-execute";
|
|
|
-
|
|
|
import typescript from "typescript";
|
|
|
|
|
|
const outputDir = "dist";
|
|
@@ -29,13 +25,8 @@ export default (/**@type {import("./src/types").RollupArgs}*/ args) => (async ()
|
|
|
const config = {
|
|
|
input: "src/index.ts",
|
|
|
plugins: [
|
|
|
- pluginReplace({
|
|
|
- "process.env.NODE_ENV": JSON.stringify(mode),
|
|
|
- ENVIRONMENT: JSON.stringify(mode),
|
|
|
- preventAssignment: true,
|
|
|
- }),
|
|
|
pluginNodeResolve({
|
|
|
- extensions: [".ts", ".tsx", ".mts", ".json"],
|
|
|
+ extensions: [".ts", ".mts", ".json"],
|
|
|
}),
|
|
|
pluginTypeScript({
|
|
|
typescript,
|
|
@@ -47,15 +38,6 @@ export default (/**@type {import("./src/types").RollupArgs}*/ args) => (async ()
|
|
|
output: "global.css",
|
|
|
}),
|
|
|
pluginMarkdown(),
|
|
|
- pluginCJS({
|
|
|
- include: [
|
|
|
- "node_modules/**"
|
|
|
- ],
|
|
|
- exclude: [
|
|
|
- "node_modules/process-es6/**"
|
|
|
- ],
|
|
|
- }),
|
|
|
- pluginBabel({ babelHelpers: "bundled" }),
|
|
|
pluginExecute([
|
|
|
`npm run --silent post-build -- --mode=${mode} --branch=${branch} --host=${host} --suffix=${suffix}`,
|
|
|
...(mode === "development" ? ["npm run --silent invisible -- \"npm run tr-progress\""] : []),
|
|
@@ -66,11 +48,6 @@ export default (/**@type {import("./src/types").RollupArgs}*/ args) => (async ()
|
|
|
format: "iife",
|
|
|
sourcemap: mode === "development",
|
|
|
compact: mode === "development",
|
|
|
- banner: "\n/* global React, ReactDOM */",
|
|
|
- globals: {
|
|
|
- react: "React",
|
|
|
- "react-dom": "ReactDOM",
|
|
|
- },
|
|
|
},
|
|
|
onwarn(warning) {
|
|
|
// ignore circular dependency warnings
|
|
@@ -79,7 +56,6 @@ export default (/**@type {import("./src/types").RollupArgs}*/ args) => (async ()
|
|
|
console.error(`\x1b[33m(!)\x1b[0m ${message}\n`, rest);
|
|
|
}
|
|
|
},
|
|
|
- external: id => /^react(-dom)?$/.test(id)
|
|
|
};
|
|
|
|
|
|
return config;
|