comparison rollup.config.js @ 78:ea9c9db282d6

automate 'external' list, get all local code to appear in lib.bundle.js
author drewp@bigasterisk.com
date Tue, 11 Feb 2020 22:55:24 -0800
parents 0ba4bd0ba245
children 0c188ed3bcd8
comparison
equal deleted inserted replaced
77:0ffe5591b048 78:ea9c9db282d6
10 namedExports: { 10 namedExports: {
11 jsonld: ["expand"] // fixes "expand is not exported by node_modules/jsonld/lib/index.js" 11 jsonld: ["expand"] // fixes "expand is not exported by node_modules/jsonld/lib/index.js"
12 } 12 }
13 }; 13 };
14 14
15 const moduleIsntLocal = (id, parentId, isResolved) => {
16 console.log("check", id, !id.startsWith("./"));
17 if (isResolved || id == "src/index.ts") {
18 return false;
19 }
20 return !id.startsWith("./");
21 };
22
15 export default [ 23 export default [
16 { 24 {
17 input: "src/index.ts", 25 input: "src/index.ts",
18 output: { 26 output: {
19 file: "build/lib.bundle.js", 27 file: "build/lib.bundle.js",
20 format: "esm", 28 format: "esm",
21 intro: `const ${workaround_some_browser_detector}, ${workaround_jsonld_module_system_picker};` 29 intro: `const ${workaround_some_browser_detector}, ${workaround_jsonld_module_system_picker};`
22 }, 30 },
23 external: [ 31 external: moduleIsntLocal,
24 "@polymer/polymer",
25 "lit-html",
26 "@polymer/decorators",
27 "n3",
28 "jsonld"
29 ],
30 plugins: [ 32 plugins: [
31 builtins(), 33 builtins(),
32 resolve({ 34 resolve({
33 extensions: [".js", ".ts"], 35 extensions: [".js", ".ts"],
34 browser: true, 36 browser: true,
35 resolveOnly: ["streamed-graph"]
36 }), 37 }),
37 typescript(), 38 typescript(),
38 postcss({ 39 postcss({
39 inject: false 40 inject: false
40 }), 41 }),