Still trying to get cra to play nice with theatre
This commit is contained in:
parent
824fdd6843
commit
f4f33dcd8d
8 changed files with 88 additions and 62 deletions
|
@ -1,6 +1,24 @@
|
|||
import path from 'path'
|
||||
import * as path from 'path'
|
||||
import {build} from 'esbuild'
|
||||
import type {Plugin} from 'esbuild'
|
||||
|
||||
const externalPlugin = (patterns: RegExp[]): Plugin => {
|
||||
return {
|
||||
name: `external`,
|
||||
|
||||
setup(build) {
|
||||
build.onResolve({filter: /.*/}, (args) => {
|
||||
const external = patterns.some((p) => {
|
||||
return p.test(args.path)
|
||||
})
|
||||
|
||||
if (external) {
|
||||
return {path: args.path, external}
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
const definedGlobals = {
|
||||
global: 'window',
|
||||
}
|
||||
|
@ -17,19 +35,20 @@ function createBundles(watch: boolean) {
|
|||
mainFields: ['browser', 'module', 'main'],
|
||||
target: ['firefox57', 'chrome58'],
|
||||
conditions: ['browser', 'node'],
|
||||
plugins: [externalPlugin([/^[\@a-zA-Z]+/])],
|
||||
}
|
||||
|
||||
build({
|
||||
...esbuildConfig,
|
||||
outfile: path.join(pathToPackage, 'dist/index.cjs'),
|
||||
outfile: path.join(pathToPackage, 'dist/index.js'),
|
||||
format: 'cjs',
|
||||
})
|
||||
|
||||
build({
|
||||
...esbuildConfig,
|
||||
outfile: path.join(pathToPackage, 'dist/index.mjs'),
|
||||
format: 'esm',
|
||||
})
|
||||
// build({
|
||||
// ...esbuildConfig,
|
||||
// outfile: path.join(pathToPackage, 'dist/index.mjs'),
|
||||
// format: 'esm',
|
||||
// })
|
||||
}
|
||||
|
||||
createBundles(false)
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type {IdentityDerivationProvider} from './Atom'
|
||||
import type {Pointer} from './pointer';
|
||||
import type {Pointer} from './pointer'
|
||||
import pointer from './pointer'
|
||||
import type {IBox} from './Box';
|
||||
import type {IBox} from './Box'
|
||||
import Box from './Box'
|
||||
import type {$FixMe, $IntentionalAny} from './types'
|
||||
import {valueDerivation} from '@theatre/dataverse'
|
||||
import {valueDerivation} from './Atom'
|
||||
|
||||
export default class PointerProxy<O extends {}>
|
||||
implements IdentityDerivationProvider
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue