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,7 +1,7 @@
|
|||
import path from 'path'
|
||||
import * as path from 'path'
|
||||
import {build} from 'esbuild'
|
||||
import type {Plugin} from 'esbuild'
|
||||
import {writeFileSync} from 'fs'
|
||||
import {mkdirSync, writeFileSync} from 'fs'
|
||||
|
||||
const externalPlugin = (patterns: RegExp[]): Plugin => {
|
||||
return {
|
||||
|
@ -46,7 +46,6 @@ function createBundles(watch: boolean) {
|
|||
define: {...definedGlobals, 'process.env.NODE_ENV': '"production"'},
|
||||
outfile: path.join(pathToPackage, 'dist/index.production.js'),
|
||||
format: 'cjs',
|
||||
treeShaking: true,
|
||||
})
|
||||
|
||||
build({
|
||||
|
@ -56,6 +55,8 @@ function createBundles(watch: boolean) {
|
|||
format: 'cjs',
|
||||
})
|
||||
|
||||
mkdirSync(path.join(pathToPackage, 'dist'))
|
||||
|
||||
writeFileSync(
|
||||
path.join(pathToPackage, 'dist/index.js'),
|
||||
`module.exports =
|
||||
|
@ -65,11 +66,11 @@ function createBundles(watch: boolean) {
|
|||
{encoding: 'utf-8'},
|
||||
)
|
||||
|
||||
build({
|
||||
...esbuildConfig,
|
||||
outfile: path.join(pathToPackage, 'dist/index.mjs'),
|
||||
format: 'esm',
|
||||
})
|
||||
// build({
|
||||
// ...esbuildConfig,
|
||||
// outfile: path.join(pathToPackage, 'dist/index.mjs'),
|
||||
// format: 'esm',
|
||||
// })
|
||||
}
|
||||
|
||||
createBundles(false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue