1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
/**
* @author Toru Nagashima
* See LICENSE file in root directory for full license.
*/
const sourcemaps = require("rollup-plugin-sourcemaps")
const packageInfo = require("./package.json")
/**
* Define the output configuration.
* @param {string} ext The extension for generated files.
* @returns {object} The output configuration
*/
function config(ext) {
return {
input: "src/index.js",
output: {
exports: ext === ".mjs" ? undefined : "named",
file: `index${ext}`,
format: ext === ".mjs" ? "es" : "cjs",
sourcemap: true,
banner: "/*! @author Toru Nagashima <https://github.com/mysticatea> */",
},
plugins: [sourcemaps()],
external: Object.keys(packageInfo.dependencies),
}
}
module.exports = [config(".js"), config(".mjs")]
|