Skip to content

Commit

Permalink
fix: add cjs file (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
malangfox committed Jun 2, 2023
1 parent 85e1a37 commit 0a0708a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@egjs/flicking",
"version": "4.10.7-snapshot",
"description": "Everyday 30 million people experience. It's reliable, flexible and extendable carousel.",
"main": "dist/flicking.js",
"main": "dist/flicking.cjs.js",
"module": "dist/flicking.esm.js",
"sideEffects": [
"**/*.css",
Expand Down
6 changes: 6 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ export default buildHelper([
format: "esm",
external,
exports: "named"
},
{
input: "./src/index.cjs.ts",
output: "./dist/flicking.cjs.js",
format: "cjs",
exports: "named",
}
]);

14 changes: 14 additions & 0 deletions src/index.cjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2015 NAVER Corp.
* egjs projects are licensed under the MIT license
*/
import Flicking, * as modules from "./index";

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

declare const module: any;
module.exports = Flicking;
export default Flicking;
export * from "./index";

0 comments on commit 0a0708a

Please sign in to comment.