Skip to content

Commit

Permalink
Try different config
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcetinkaya committed Jun 27, 2020
1 parent ce62468 commit 1fa9fee
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 13 deletions.
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,19 @@
"react"
],
"license": "MIT",
"main": "lib/index.cjs.js",
"jsnext:main": "lib/index.cjs.js",
"module": "lib/index.cjs.js",
"types": "lib/index.d.ts",
"main": "./lib/index.js",
"module": "./lib/es/index.js",
"types": "./lib/index.d.ts",
"exports": {
".": {
"node": {
"require": "./lib/index.js",
"import": "./lib/es/index.js"
},
"default": "./lib/embla-carousel.browser.js"
},
"./lib/": "./lib/"
},
"repository": {
"type": "git",
"url": "git+https://github.com/davidcetinkaya/embla-carousel"
Expand Down
60 changes: 53 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,41 @@ const typescriptConfig = {
useTsconfigDeclarationDir: true,
}
const resolveConfig = {
customResolveOptions: {
moduleDirectory: 'react',
},
// jsnext: true,
// main: true,
// browser: true,
// customResolveOptions: {
// moduleDirectory: 'react',
// },
}

export default [
// {
// external: ['react'],
// input: 'src/index.ts',
// output: [
// {
// format: 'iife',
// name: 'EmblaCarousel',
// strict: true,
// file: 'lib/index.js',
// sourcemap: true,
// },
// ],
// plugins: [
// resolve(resolveConfig),
// commonjs(),
// typescript(typescriptConfig),
// babel(babelConfig),
// // terser(),
// ],
// },
{
external: ['react'],
input: {
[`index.${DEFAULT_FORMAT}`]: 'src/index.ts',
[`embla-carousel.${DEFAULT_FORMAT}`]: 'src/vanilla/index.ts',
[`react.${DEFAULT_FORMAT}`]: 'src/react/index.ts',
[`index`]: 'src/index.ts',
[`embla-carousel`]: 'src/vanilla/index.ts',
[`react`]: 'src/react/index.ts',
},
output: [
{
Expand All @@ -46,14 +69,37 @@ export default [
babel(babelConfig),
],
},
{
external: ['react'],
input: {
[`index`]: 'src/index.ts',
[`embla-carousel`]: 'src/vanilla/index.ts',
[`react`]: 'src/react/index.ts',
},
output: [
{
format: 'esm',
name: 'EmblaCarousel',
strict: true,
sourcemap: true,
dir: 'lib/es',
globals: { react: 'React' },
},
],
plugins: [
resolve(resolveConfig),
typescript(typescriptConfig),
babel(babelConfig),
],
},
{
input: 'src/vanilla/index.ts',
output: [
{
format: 'umd',
name: 'EmblaCarousel',
strict: true,
file: 'lib/embla-carousel.js',
file: 'lib/embla-carousel.browser.js',
sourcemap: true,
},
],
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { default } from './vanilla'
export { useEmblaCarousel } from './react'
import EmblaCarousel from './vanilla'
import { useEmblaCarousel } from './react'

export { EmblaCarousel, useEmblaCarousel }

0 comments on commit 1fa9fee

Please sign in to comment.