Skip to content

Commit

Permalink
Add output externals
Browse files Browse the repository at this point in the history
  • Loading branch information
bodjay committed Apr 24, 2020
1 parent b7b445c commit e3bc353
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,50 @@ export default [
sourcemap: true,
format: "iife",
name: "app",
file: "public/build/bundle.js"
file: "public/build/bundle.js",
},
plugins: [
svelte({
dev: !production,
css: css => {
css: (css) => {
css.write("public/build/bundle.css");
}
},
}),
resolve({
browser: true,
dedupe: importee =>
importee === "svelte" || importee.startsWith("svelte/")
dedupe: (importee) =>
importee === "svelte" || importee.startsWith("svelte/"),
}),
commonjs(),
!production && serve(),
!production && livereload("public"),
production && terser()
production && terser(),
],
watch: {
clearScreen: false
}
clearScreen: false,
},
},
{
input: "src/CopyToClipboard.svelte",
output: { file: pkg.main, format: "umd", name: "CopyToClipboard" },
plugins: [svelte(), resolve(), commonjs()]
output: {
file: pkg.main,
format: "umd",
name: "CopyToClipboard",
globals: { svelte: "svelte", "svelte/internal": "svelte/internal" },
},
external: ["svelte/internal"],
plugins: [svelte(), resolve(), commonjs()],
},
{
input: "src/CopyToClipboard.svelte",
output: { file: pkg.module, format: "es" },
external: ["svelte/internal"],
plugins: [svelte(), commonjs()]
}
output: {
file: pkg.module,
format: "es",
globals: { svelte: "svelte", "svelte/internal": "svelte/internal" },
},
external: ["svelte/internal", "svelte"],
plugins: [svelte(), commonjs()],
},
];

function serve() {
Expand All @@ -60,9 +70,9 @@ function serve() {

require("child_process").spawn("npm", ["run", "start", "--", "--dev"], {
stdio: ["ignore", "inherit", "inherit"],
shell: true
shell: true,
});
}
}
},
};
}

0 comments on commit e3bc353

Please # to comment.