Build both cjs and mjs versions
This commit is contained in:
parent
667a5ab990
commit
2339030fe2
|
@ -4,13 +4,12 @@
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "Handlebars wrapper for Budibase templating.",
|
"description": "Handlebars wrapper for Budibase templating.",
|
||||||
"main": "dist/bundle.cjs",
|
"main": "dist/bundle.cjs",
|
||||||
"module": "src/index.ts",
|
"module": "dist/bundle.mjs",
|
||||||
"license": "MPL-2.0",
|
"license": "MPL-2.0",
|
||||||
"types": "dist/index.d.ts",
|
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"require": "./dist/bundle.cjs",
|
"require": "./dist/bundle.cjs",
|
||||||
"import": "./src/index.ts"
|
"import": "./dist/bundle.mjs"
|
||||||
},
|
},
|
||||||
"./package.json": "./package.json",
|
"./package.json": "./package.json",
|
||||||
"./test/utils": "./test/utils.js"
|
"./test/utils": "./test/utils.js"
|
||||||
|
|
|
@ -9,28 +9,31 @@ import injectProcessEnv from "rollup-plugin-inject-process-env"
|
||||||
|
|
||||||
const production = !process.env.ROLLUP_WATCH
|
const production = !process.env.ROLLUP_WATCH
|
||||||
|
|
||||||
export default [
|
const config = (format, outputFile) => ({
|
||||||
{
|
input: "src/index.ts",
|
||||||
input: "src/index.ts",
|
output: {
|
||||||
output: {
|
sourcemap: !production,
|
||||||
sourcemap: !production,
|
format,
|
||||||
format: "cjs",
|
file: outputFile,
|
||||||
file: "./dist/bundle.cjs",
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
typescript({ tsconfig: "tsconfig.json" }),
|
|
||||||
resolve({
|
|
||||||
preferBuiltins: true,
|
|
||||||
browser: true,
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
globals(),
|
|
||||||
builtins(),
|
|
||||||
json(),
|
|
||||||
injectProcessEnv({
|
|
||||||
NO_JS: process.env.NO_JS,
|
|
||||||
}),
|
|
||||||
production && terser(),
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
|
plugins: [
|
||||||
|
typescript({ tsconfig: "tsconfig.json" }),
|
||||||
|
resolve({
|
||||||
|
preferBuiltins: true,
|
||||||
|
browser: true,
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
globals(),
|
||||||
|
builtins(),
|
||||||
|
json(),
|
||||||
|
injectProcessEnv({
|
||||||
|
NO_JS: process.env.NO_JS,
|
||||||
|
}),
|
||||||
|
// production && terser(),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
|
export default [
|
||||||
|
config("cjs", "./dist/bundle.cjs"),
|
||||||
|
config("esm", "./dist/bundle.mjs"),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue