Skip to content

Commit

Permalink
Exporting both default and named export
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Jan 12, 2017
1 parent a12b8cf commit 665f907
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ One way to achieve this is to add versioning to your store to begin with.
## Usage

```ts
import { getStore, Store } from 'global-store'
import getStore, { Store } from 'global-store'

interface StoreType { ... }
const defaultValue: StoreType = { ... }
Expand Down
2 changes: 1 addition & 1 deletion dist/global-store.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/global-store.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rollup.config.global.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export default {
moduleId: pkg.name,
moduleName,
entry: 'dist/commonjs/index.js',
exports: 'named',
dest: `dist/${paramCase(pkg.name)}.js`,
format: 'iife',
sourceMap: true,
Expand Down
7 changes: 6 additions & 1 deletion src/getStore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import test from 'ava'
import { getLogger, Logger, Appender } from 'aurelia-logging'

import { removeStore } from './getStore'
import { getStore } from './index'
import defaultGet, { getStore } from './index'

const logger = getLogger('GlobalStore:spec')

test('shape', t => {
t.is(defaultGet, getStore)
})

test('simple string store', t => {
const store = getStore('something')
store.value = 'somevalue'
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getStore, Store } from './getStore'

// Avoid using default export so it will play nicely in CommonJS and global namespace.
export default getStore
export { getStore, Store }

0 comments on commit 665f907

Please sign in to comment.