import alias from "rollup-plugin-alias"; import resolve from "rollup-plugin-node-resolve"; import commonjs from "rollup-plugin-commonjs"; import babel from "rollup-plugin-babel"; import replace from "rollup-plugin-replace"; import json from "rollup-plugin-json"; import postcss from "rollup-plugin-postcss"; export default { input: "src/main.js", plugins: [ alias({ resolve: [".js"], }), replace({ "process.env.NODE_ENV": JSON.stringify( process.env.NODE_ENV || "development" ), }), postcss({ extensions: [".css"], }), // NOTE: ****** 2020.5.7 兼容 axios, 否则报错 process 未定义 ****** resolve({ jsnext: true, preferBuiltins: true, browser: true, }), commonjs({ // non-CommonJS modules will be ignored, but you can also // specifically include/exclude files include: "node_modules/**", }), babel({ runtimeHelpers: true, exclude: "node_modules/**", // only transpile our source code }), json({ // All JSON files will be parsed by default, // but you can also specifically include/exclude files include: "node_modules/**", exclude: ["node_modules/foo/**", "node_modules/bar/**"], // for tree-shaking, properties will be declared as // variables, using either `var` or `const` preferConst: true, // Default: false // specify indentation for the generated default export — // defaults to '\t' indent: " ", // ignores indent and generates the smallest code compact: true, // Default: false // generate a named export for every property of the JSON object namedExports: true, // Default: true }), ], };