-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(esm/cjs): Build rwjs/web to cjs with new build system (#10826)
- Loading branch information
Showing
25 changed files
with
79 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// import { writeFileSync } from 'node:fs' | ||
|
||
import { | ||
build, | ||
defaultBuildOptions, | ||
defaultIgnorePatterns, | ||
} from '@redwoodjs/framework-tools' | ||
|
||
// CJS build | ||
await build({ | ||
entryPointOptions: { | ||
ignore: [...defaultIgnorePatterns], | ||
}, | ||
buildOptions: { | ||
...defaultBuildOptions, | ||
// ⭐ No special tsconfig here | ||
// outdir: 'dist/cjs', DONT DO THIS JUST YET | ||
outdir: 'dist', | ||
packages: 'external', | ||
}, | ||
}) | ||
|
||
/** THIS IS IN PART 2 ~ making this a dual module | ||
Will enable in follow up PR | ||
ESM build | ||
await build({ | ||
entryPointOptions: { | ||
ignore: [...defaultIgnorePatterns, 'src/entry/**'], | ||
}, | ||
buildOptions: { | ||
...defaultBuildOptions, | ||
// ⭐ No special tsconfig here | ||
// tsconfig: 'tsconfig.build.json', | ||
format: 'esm', | ||
packages: 'external', | ||
}, | ||
}) | ||
// Place a package.json file with `type: commonjs` in the dist folder so that | ||
// all .js files are treated as CommonJS files. | ||
writeFileSync('dist/cjs/package.json', JSON.stringify({ type: 'commonjs' })) | ||
// Place a package.json file with `type: module` in the dist/esm folder so that | ||
// all .js files are treated as ES Module files. | ||
writeFileSync('dist/package.json', JSON.stringify({ type: 'module' })) | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import React from 'react' | ||
|
||
import type { | ||
ApolloClientOptions, | ||
setLogVerbosity, | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import React from 'react' | ||
|
||
type PropsInfallibleErrorBoundary = Partial<{ | ||
children: React.ReactNode | ||
}> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import React from 'react' | ||
|
||
import type { | ||
OperationVariables, | ||
useBackgroundQuery as apolloUseBackgroundQuery, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import React from 'react' | ||
import { Fragment } from 'react' | ||
|
||
declare const window: { | ||
|
2 changes: 2 additions & 0 deletions
2
packages/web/src/entry/index.js → packages/web/src/entry/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters