const exportName = pascalcase(pkg.name)
-function createEntry(
- {
- format, // Rollup format (iife, umd, cjs, es)
- external, // Rollup external option
- input = 'src/index.ts', // entry point
- env = 'development', // NODE_ENV variable
- minify = false,
- isBrowser = false, // produce a browser module version or not
- } = {
- input: 'src/index.ts',
- env: 'development',
- minify: false,
- isBrowser: false,
- }
-) {
+function createEntry({
+ format, // Rollup format (iife, umd, cjs, es)
+ external = ['vue', '@vue/composition-api'],
+ input = 'src/index.ts', // entry point
+ env = 'development', // NODE_ENV variable
+ minify = false,
+ isBrowser = false, // produce a browser module version or not
+}) {
// force production mode when minifying
if (minify) env = 'production'
config.plugins.push(resolve(), commonjs())
} else {
config.external = external
+ config.globals = {
+ '@vue/composition-api': 'VueCompositionApi',
+ }
}
config.plugins.push(
return store
}
-function makeStore<Id extends string, S extends StateTree>(
- id: Id,
- buildState: () => S
-) {
- let store: Store<Id, S> | undefined
+/**
+ * The api needs more work we must be able to use the store easily in any
+ * function by calling `useStore` to get the store Instance and we also need to
+ * be able to reset the store instance between requests on the server
+ */
+
+/**
+ *
+ * @param id id of the store we are creating
+ * @param buildState function that returns a state
+ */
- function useStore(): Store<Id, S> {
- if (!store) store = createStore(id, buildState)
+// function makeStore<Id extends string, S extends StateTree>(
+// id: Id,
+// buildState: () => S
+// ) {
+// let store: Store<Id, S> | undefined
- return store
- }
+// function useStore(): Store<Id, S> {
+// if (!store) store = createStore(id, buildState)
- function clear(): void {
- store = undefined
- }
+// return store
+// }
- return {
- useStore,
- clear,
- }
-}
+// function clear(): void {
+// store = undefined
+// }
+
+// return {
+// useStore,
+// clear,
+// }
+// }
// export const store = createStore('main', initialState)
// export const cartStore = createStore('cart', {