Build both cjs and mjs versions
This commit is contained in:
parent
667a5ab990
commit
2339030fe2
|
@ -4,13 +4,12 @@
|
|||
"version": "0.0.0",
|
||||
"description": "Handlebars wrapper for Budibase templating.",
|
||||
"main": "dist/bundle.cjs",
|
||||
"module": "src/index.ts",
|
||||
"module": "dist/bundle.mjs",
|
||||
"license": "MPL-2.0",
|
||||
"types": "dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"require": "./dist/bundle.cjs",
|
||||
"import": "./src/index.ts"
|
||||
"import": "./dist/bundle.mjs"
|
||||
},
|
||||
"./package.json": "./package.json",
|
||||
"./test/utils": "./test/utils.js"
|
||||
|
|
|
@ -9,28 +9,31 @@ import injectProcessEnv from "rollup-plugin-inject-process-env"
|
|||
|
||||
const production = !process.env.ROLLUP_WATCH
|
||||
|
||||
export default [
|
||||
{
|
||||
input: "src/index.ts",
|
||||
output: {
|
||||
sourcemap: !production,
|
||||
format: "cjs",
|
||||
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(),
|
||||
],
|
||||
const config = (format, outputFile) => ({
|
||||
input: "src/index.ts",
|
||||
output: {
|
||||
sourcemap: !production,
|
||||
format,
|
||||
file: outputFile,
|
||||
},
|
||||
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