// Rollup plugins import babel from "rollup-plugin-babel"; import resolve from "rollup-plugin-node-resolve"; import commonjs from "rollup-plugin-commonjs"; // import replace from "rollup-plugin-replace"; import { terser } from "rollup-plugin-terser"; // Rollup plugin to minify generated es bundle. import { string } from "rollup-plugin-string"; // 这个 rollup-plugin-commonjs 插件就是用来将 CommonJS 转换成 ES2015 模块的。 import { uglify } from "rollup-plugin-uglify"; // 这个东西不支持ES6的构建的时候 得target是ES5 import postcss from "rollup-plugin-postcss"; // import nested from "postcss-nested"; import cssnext from "postcss-cssnext"; // import template from "rollup-plugin-templatejs"; import sass from "rollup-plugin-sass"; // import expression from "@templatejs/runtime"; export default { plugins: [ postcss({ plugins: [cssnext()], extensions: [".scss"], }), sass({ insert: true, }), resolve({ jsnext: true, main: true, browser: true, }), commonjs(), babel({ exclude: "node_modules/**", }), string({ // Required to be specified include: "**/*.tmpl", // Undefined by default exclude: ["**/index.html"] }) // template({ // sTag: "<#", // eTag: "#>", // expression: "requrie('@templatejs/runtime')", // 获取template的表达式,如 `window.template` // sandbox: false, // 沙箱模式 // include: ["**/*.tmpl"], // 默认值 // exclude: "node_modules/**", // 默认值 // }), // replace({ // ENV: JSON.stringify(process.env.NODE_ENV || "development"), // }), // terser(), // uglify(), ], input: "./src/main.js", output: [ { file: "../../build/plugins/plugins-popup-tksj.js", format: "umd", //"amd", "cjs", "system", "esm", "iife" or "umd". name: "main", }, ], };