UNPKG

sfx-meteojs

Version:

气象 JS 库, Javascript library for meteorological and atmospheric tools

86 lines (84 loc) 3.46 kB
// --------------------------------------------------------- import path from "path"; import alias from "@rollup/plugin-alias"; import json from "@rollup/plugin-json"; import terser from "@rollup/plugin-terser"; import commonjs from "@rollup/plugin-commonjs"; import typescript from "@rollup/plugin-typescript"; import nodeResolve from "@rollup/plugin-node-resolve"; // import { name } from "./package.json" // --------------------------------------------------------- const ROOT = process.cwd(); // const isProduction = true; const isProduction = false; // const isProduction = process.env.NODE_ENV === 'production'; // 在编译时使用 model = production const banner = `/** * @name meteojs * @author shenyc * @date 2023-06-18 - ? * @copyright Copy right (c) shenyc (shenyczz@163.com). * All rights reserved. * ******************************************************************************/`; const footer = "/* my-library footer */"; // --------------------------------------------------------- export default { input: { "main": "src/index.ts", }, output: [ { dir: "dist", format: "amd", // "amd", "cjs", "system", "es" , "iife" or "umd" entryFileNames: "[name].js", sourcemap: true, // boolean | 'inline' | 'hidden' sourcemapExcludeSources: true, // 源代码是否添加到 sourcemap 文件中 compact: false, // 生成紧凑代码 assetFileNames: "assets/[name]-[hash][extname]", banner: banner, }, // { // dir: "dist/cjs", // format: "cjs", // "amd", "cjs", "system", "es" , "iife" or "umd" // entryFileNames: isProduction ? "[name]-[format]-min.js" : "[name]-[format].js", // assetFileNames: "assets/[name]-[hash][extname]", // sourcemap: true, // boolean | 'inline' | 'hidden' // sourcemapExcludeSources: true, // true 标识实际源代码不会被添加到 sourcemap 文件中 // compact: false, // 紧凑 // }, // { // dir: "dist/esm", // format: "es", // "amd", "cjs", "es", "system", "iife" or "umd" // entryFileNames: isProduction ? "[name]-[format]-min.js" : "[name]-[format].js", // assetFileNames: "assets/[name]-[hash][extname]", // sourcemap: true, // boolean | 'inline' | 'hidden' // sourcemapExcludeSources: true, // true 标识实际源代码不会被添加到 sourcemap 文件中 // compact: false, // 紧凑 // }, ], // plugins: [ json(), nodeResolve(), // commonjs(), // isProduction && [terser()], typescript({ cacheDir: "./cache", include: [".ts", ".tsx"], tsconfig: "./tsconfig.json", }), alias({ resolve: [".js", ".ts", "json"], }), ], // 该选项用于匹配需要保留在 bundle 外部的模块, external: [ // ID // "some-externally-required-library", // 绝对路径 // path.resolve(ROOT, "src/some-local-file-that-should-not-be-bundled.js"), // 文件夹 // /node_modules/, ], strictDeprecations: false, // 废弃警告 };