Skip to content

Commit

Permalink
fix: create cjs build and fix wrong exports
Browse files Browse the repository at this point in the history
  • Loading branch information
WoodNeck authored Apr 12, 2023
1 parent f9fd058 commit 61b2e39
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/react-view360/src/index.umd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
* egjs projects are licensed under the MIT license
*/
import View360 from "./View360";
import * as modules from "@egjs/view360";

for (const name in modules) {
(View360 as any)[name] = (modules as any)[name];
}

export default View360;
5 changes: 5 additions & 0 deletions packages/svelte-view360/src/index.umd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
* egjs projects are licensed under the MIT license
*/
import View360 from "./View360";
import * as modules from "@egjs/view360";

for (const name in modules) {
(View360 as any)[name] = (modules as any)[name];
}

export default View360;
2 changes: 1 addition & 1 deletion packages/view360/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@egjs/view360",
"version": "4.0.0-beta.5",
"description": "360 integrated viewing solution from inside-out view to outside-in view. It provides user-friendly service by rotating 360 degrees through various user interaction such as motion sensor and touch.",
"main": "dist/view360.js",
"main": "dist/view360.cjs.js",
"module": "dist/view360.esm.js",
"es2015": "dist/view360.esm.js",
"types": "declaration/index.d.ts",
Expand Down
9 changes: 8 additions & 1 deletion packages/view360/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,12 @@ module.exports = buildHelper([
exports: "named",
external,
...common
}
},
{
input: "./src/index.cjs.ts",
output: `./dist/${fileName}.cjs.js`,
format: "cjs",
exports: "named",
...common
}
]);
13 changes: 13 additions & 0 deletions packages/view360/src/index.cjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2023-present NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import View360, * as modules from "./index";
import { merge } from "./utils";

merge(View360, modules);

declare const module: any;
module.exports = View360;
export default View360;
export * from "./index";
5 changes: 5 additions & 0 deletions packages/vue-view360/src/index.umd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import { VueConstructor } from "vue";

import View360 from "./View360";
import * as modules from "@egjs/view360";

for (const name in modules) {
(View360 as any)[name] = (modules as any)[name];
}

declare global {
interface Window {
Expand Down
5 changes: 5 additions & 0 deletions packages/vue3-view360/src/index.umd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import { App } from "vue";

import View360 from "./View360";
import * as modules from "@egjs/view360";

for (const name in modules) {
(View360 as any)[name] = (modules as any)[name];
}

export default {
install: (app: App) => {
Expand Down

0 comments on commit 61b2e39

Please sign in to comment.