Expose iife

This commit is contained in:
Adria Navarro 2024-11-19 10:38:02 +01:00
parent fb80647013
commit 50ac79396e
2 changed files with 6 additions and 5 deletions

View File

@ -12,7 +12,7 @@
"import": "./dist/bundle.mjs"
},
"./package.json": "./package.json",
"./iife": "./src/iife.js"
"./iife": "./dist/iife.mjs"
},
"scripts": {
"build": "tsc --emitDeclarationOnly && rollup -c",

View File

@ -10,8 +10,8 @@ import inject from "@rollup/plugin-inject"
const production = !process.env.ROLLUP_WATCH
const config = (format, outputFile) => ({
input: "src/index.ts",
const config = (input, outputFile, format) => ({
input,
output: {
sourcemap: !production,
format,
@ -42,6 +42,7 @@ const config = (format, outputFile) => ({
})
export default [
config("cjs", "./dist/bundle.cjs"),
config("esm", "./dist/bundle.mjs"),
config("src/index.ts", "./dist/bundle.cjs", "cjs"),
config("src/index.ts", "./dist/bundle.mjs", "esm"),
config("src/iife.ts", "./dist/iife.mjs", "esm"),
]