[FIX] package.json: remove browser value

As far as I can tell, the browser value overrides the main value in many
cases.  But then, we don't want to use the iife format, since it don't
work well with bundlers. This commit fixes the issue by simply removing
the key, so the main entry will be used instead.

maybe fixes #1181
This commit is contained in:
Géry Debongnie
2022-07-12 13:07:03 +02:00
committed by Sam Degueldre
parent 7786077921
commit 9fd662fdce
2 changed files with 16 additions and 9 deletions
+16 -8
View File
@@ -6,6 +6,14 @@ import dts from "rollup-plugin-dts";
let input, output;
const IIFE_FILENAME = "dist/owl.iife.js";
const CJS_FILENAME = "dist/owl.cjs.js";
const ES_FILENAME = "dist/owl.es.js";
if (pkg.module !== ES_FILENAME || pkg.main !== CJS_FILENAME) {
throw new Error("package.json has been modified. Build script should be updated accordingly");
}
const outro = `
__info__.version = '${pkg.version}';
__info__.date = '${new Date().toISOString()}';
@@ -23,19 +31,19 @@ switch (process.argv[4]) {
case "runtime":
input = "src/runtime/index.ts";
output = [
getConfigForFormat('esm', addSuffix(pkg.module, 'runtime'), outro),
getConfigForFormat('cjs', addSuffix(pkg.main, 'runtime'), outro),
getConfigForFormat('iife', addSuffix(pkg.browser, 'runtime'), outro),
getConfigForFormat('iife', addSuffix(pkg.browser, 'runtime'), outro, true),
getConfigForFormat('esm', addSuffix(ES_FILENAME, 'runtime'), outro),
getConfigForFormat('cjs', addSuffix(CJS_FILENAME, 'runtime'), outro),
getConfigForFormat('iife', addSuffix(IIFE_FILENAME, 'runtime'), outro),
getConfigForFormat('iife', addSuffix(IIFE_FILENAME, 'runtime'), outro, true),
]
break;
default:
input = "src/index.ts",
output = [
getConfigForFormat('esm', pkg.module, outro),
getConfigForFormat('cjs', pkg.main, outro),
getConfigForFormat('iife', pkg.browser, outro),
getConfigForFormat('iife', pkg.browser, outro, true),
getConfigForFormat('esm', ES_FILENAME, outro),
getConfigForFormat('cjs', CJS_FILENAME, outro),
getConfigForFormat('iife', IIFE_FILENAME, outro),
getConfigForFormat('iife', IIFE_FILENAME, outro, true),
]
}