Skip to content

Commit 799887e

Browse files
committed
build: rename main into index
1 parent d68a02e commit 799887e

File tree

3 files changed

+24
-37
lines changed

3 files changed

+24
-37
lines changed

rollup.config.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,13 @@ import pkg from "./package.json";
88
const resolve = (_path) => path.resolve(__dirname, _path);
99

1010
export default {
11-
input: resolve("./src/main.js"),
11+
input: resolve("./src/index.js"),
1212
output: [
1313
{
1414
file: pkg.main,
1515
name: "VueLive",
16-
format: "umd",
16+
format: "cjs",
1717
exports: "named", // remove warning about mixed exports
18-
globals: {
19-
"hash-sum": "vueLiveHashSum",
20-
"vue-inbrowser-compiler": "vueLivevueInbrowserCompiler",
21-
"vue-template-compiler": "vueLiveVueTemplateCompiler",
22-
"vue-prism-editor": "VuePrismEditor",
23-
debounce: "debounce",
24-
acorn: "acorn",
25-
recast: "recast",
26-
},
2718
},
2819
{
2920
file: pkg.module,
@@ -40,15 +31,16 @@ export default {
4031
runtimeHelpers: true,
4132
}),
4233
vue({
43-
template: {
44-
optimizeSSR: true
45-
}
46-
}),
34+
template: {
35+
optimizeSSR: true,
36+
},
37+
}),
4738
css(),
4839
],
4940
external: [
5041
...Object.keys(pkg.dependencies),
5142
// make sure jsx schema is loaded from external
5243
"prismjs/components/prism-jsx.min",
44+
"@vue/compiler-core/dist/compiler-core.cjs",
5345
],
5446
};

src/index.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
1-
import VueLive from './VueLive';
2-
import VueLiveEditor from './Editor';
3-
import VueLivePreview from './Preview';
1+
import VueLive from "./VueLive.vue";
2+
import VueLivePreview from "./Preview.vue";
3+
import VueLiveEditor from './Editor.vue';
44

5-
export { VueLive, VueLiveEditor, VueLivePreview };
5+
// Export components individually
6+
export { VueLive };
7+
export { VueLivePreview };
8+
export { VueLiveEditor };
9+
10+
// What should happen if the user installs the library as a plugin
11+
function install(Vue) {
12+
Vue.component("VueLive", VueLive);
13+
Vue.component("VueLivePreview", VueLivePreview);
14+
Vue.component("VueLiveEditor", VueLiveEditor);
15+
}
16+
17+
// Export the library as a plugin
18+
export default { install: install };

src/main.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)