add replace plugin
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @Author: yehuozhili
|
||||
* @Date: 2021-09-30 09:51:40
|
||||
* @LastEditors: yehuozhili
|
||||
* @LastEditTime: 2021-10-07 13:18:49
|
||||
* @LastEditTime: 2021-10-07 17:51:09
|
||||
* @FilePath: \dooringx\packages\dooringx-plugin-template\template\rollup.config.js
|
||||
*/
|
||||
import { DEFAULT_EXTENSIONS } from "@babel/core";
|
||||
@@ -14,6 +14,7 @@ import resolve from "@rollup/plugin-node-resolve";
|
||||
import url from "@rollup/plugin-url";
|
||||
import svgr from "@svgr/rollup";
|
||||
import { terser } from "rollup-plugin-terser";
|
||||
import replace from "@rollup/plugin-replace";
|
||||
import typescriptEngine from "typescript";
|
||||
import external from "rollup-plugin-peer-deps-external";
|
||||
const externalPkg = ["react", "react-dom"];
|
||||
@@ -29,6 +30,7 @@ export default {
|
||||
globals: { react: "React", "react-dom": "ReactDom" },
|
||||
freeze: false,
|
||||
exports: "default",
|
||||
sourcemap: true,
|
||||
},
|
||||
],
|
||||
onwarn: function (warning) {
|
||||
@@ -49,6 +51,10 @@ export default {
|
||||
external({
|
||||
includeDependencies: true,
|
||||
}),
|
||||
replace({
|
||||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
||||
preventAssignment: true,
|
||||
}),
|
||||
typescript({
|
||||
typescript: typescriptEngine,
|
||||
include: ["*.js+(|x)", "**/*.js+(|x)"],
|
||||
|
@@ -7,14 +7,14 @@
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"publishConfig": {
|
||||
"registry": "http://registry.npmjs.org/"
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/H5-Dooring/dooringx.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "rimraf ./dist && rollup -c"
|
||||
"build": "rimraf ./dist && rollup -c --environment NODE_ENV:production"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/H5-Dooring/dooringx/issues"
|
||||
@@ -45,7 +45,8 @@
|
||||
"rollup-plugin-peer-deps-external": "^2.2.4",
|
||||
"rollup-plugin-postcss": "^4.0.1",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"rollup-plugin-typescript2": "^0.30.0"
|
||||
"rollup-plugin-typescript2": "^0.30.0",
|
||||
"@rollup/plugin-replace": "^3.0.0"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
Reference in New Issue
Block a user