bugfix: MD build broken - shortid

This commit is contained in:
Michael Shanks 2020-02-27 22:06:35 +00:00
parent 2d67d031c3
commit 4c5654594e
2 changed files with 19 additions and 3 deletions

View File

@ -1,6 +1,7 @@
import svelte from "rollup-plugin-svelte" import svelte from "rollup-plugin-svelte"
import postcss from "rollup-plugin-postcss" import postcss from "rollup-plugin-postcss"
import resolve from "rollup-plugin-node-resolve" import resolve from "rollup-plugin-node-resolve"
import commonjs from "rollup-plugin-commonjs"
const postcssOptions = () => ({ const postcssOptions = () => ({
extensions: [".scss", ".sass"], extensions: [".scss", ".sass"],
@ -16,6 +17,10 @@ const postcssOptions = () => ({
], ],
}) })
const coreExternal = [
"shortid",
]
export default { export default {
input: "src/index.js", input: "src/index.js",
output: [ output: [
@ -30,7 +35,18 @@ export default {
svelte({ svelte({
hydratable: true, hydratable: true,
}), }),
resolve(), resolve({
preferBuiltins: true,
browser: true,
dedupe: importee => {
return coreExternal.includes(importee)
},
}),
commonjs({
namedExports: {
shortid: ["generate"],
},
}),
postcss(postcssOptions()), postcss(postcssOptions()),
], ],
} }

View File

@ -3,7 +3,7 @@
import { Radiobutton } from "../Radiobutton" import { Radiobutton } from "../Radiobutton"
import { Checkbox } from "../Checkbox" import { Checkbox } from "../Checkbox"
import ClassBuilder from "../ClassBuilder.js" import ClassBuilder from "../ClassBuilder.js"
import shortid from "shortid" import { generate } from "shortid"
const cb = new ClassBuilder("list-item") const cb = new ClassBuilder("list-item")
@ -28,7 +28,7 @@
let role = "option" let role = "option"
onMount(() => { onMount(() => {
_id = shortid.generate() _id = generate()
selectedItems = _bb.getContext("BBMD:list:selectItemStore") selectedItems = _bb.getContext("BBMD:list:selectItemStore")