chore: webpack published package bugs

This commit is contained in:
James
2023-10-01 16:20:18 -04:00
parent 2649ceaac6
commit 44b10cc9b4
8 changed files with 32 additions and 11 deletions

2
.gitignore vendored
View File

@@ -373,3 +373,5 @@ $RECYCLE.BIN/
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
/build

28
.vscode/launch.json vendored
View File

@@ -14,7 +14,10 @@
"cwd": "${workspaceFolder}",
"name": "Run Dev Fields",
"request": "launch",
"type": "node-terminal"
"type": "node-terminal",
"env": {
"NODE_ENV": "production"
}
},
{
"command": "pnpm run dev:postgres collections-graphql -- -I", // Allow input
@@ -35,17 +38,30 @@
"cwd": "${workspaceFolder}",
"name": "Run Dev Fields (Vite)",
"request": "launch",
"type": "node-terminal",
"env": {
"NODE_ENV": "production"
}
},
{
"command": "ts-node ./packages/payload/src/bin/index.ts build",
"env": {
"PAYLOAD_CONFIG_PATH": "test/fields/config.ts",
"PAYLOAD_BUNDLER": "vite",
"DISABLE_SWC": "true" // SWC messes up debugging the bin scripts
},
"name": "Build CLI - Vite",
"outputCapture": "std",
"request": "launch",
"type": "node-terminal"
},
{
"command": "ts-node ./packages/payload/src/bin/index.ts migrate",
"command": "ts-node ./packages/payload/src/bin/index.ts build",
"env": {
"PAYLOAD_CONFIG_PATH": "test/migrations-cli/config.ts",
"PAYLOAD_DATABASE": "postgres",
"PAYLOAD_CONFIG_PATH": "test/fields/config.ts",
"DISABLE_SWC": "true" // SWC messes up debugging the bin scripts
// "PAYLOAD_DROP_DATABASE": "true",
},
"name": "Migrate CLI - migrate",
"name": "Build CLI - Webpack",
"outputCapture": "std",
"request": "launch",
"type": "node-terminal"

View File

@@ -24,6 +24,7 @@
"compression": "1.7.4",
"connect-history-api-fallback": "1.6.0",
"get-port": "5.1.1",
"path-browserify": "1.0.1",
"rollup-plugin-scss": "^4.0.0",
"vite": "^4.4.9",
"vite-plugin-commonjs": "^0.8.2",

View File

@@ -15,7 +15,7 @@ export const buildAdmin: BuildAdminType = async ({ payloadConfig, viteConfig: vi
// TODO: merge vite configs (https://vitejs.dev/guide/api-javascript.html#mergeconfig)
try {
vite.build(viteConfig)
await vite.build(viteConfig)
} catch (e) {
console.error(e)
throw new Error('Error: there was an error building the vite prod config.')

View File

@@ -8,7 +8,7 @@ import webpack from 'webpack'
const mockModulePath = path.resolve(__dirname, '../mocks/emptyModule.js')
const mockDotENVPath = path.resolve(__dirname, '../mocks/dotENV.js')
const nodeModulesPath = path.resolve(__dirname, '../../node_modules')
const nodeModulesPath = path.resolve(__dirname, '../../../../')
const adminFolderPath = path.resolve(nodeModulesPath, 'payload/dist/admin')
const bundlerPath = path.resolve(__dirname, '../')
@@ -80,6 +80,5 @@ export const getBaseConfig = (payloadConfig: SanitizedConfig): Configuration =>
http: false,
https: false,
},
modules: ['node_modules', nodeModulesPath],
},
})

View File

@@ -10,6 +10,7 @@ import React from 'react'
import { BrowserRouter as Router } from 'react-router-dom'
import { Slide, ToastContainer } from 'react-toastify'
import { NavProvider } from './components/elements/Nav/context'
import { StepNavProvider } from './components/elements/StepNav'
import { AuthProvider } from './components/utilities/Auth'
import { ConfigProvider } from './components/utilities/Config'
@@ -21,8 +22,6 @@ import { PreferencesProvider } from './components/utilities/Preferences'
import { SearchParamsProvider } from './components/utilities/SearchParams'
import { ThemeProvider } from './components/utilities/Theme'
import { Routes } from './components/views/Routes'
import { NavProvider } from './components/elements/Nav/context'
import './scss/app.scss'
const Root = () => {

3
pnpm-lock.yaml generated
View File

@@ -135,6 +135,9 @@ importers:
get-port:
specifier: 5.1.1
version: 5.1.1
path-browserify:
specifier: 1.0.1
version: 1.0.1
react-dom:
specifier: 18.2.0
version: 18.2.0(react@18.2.0)

View File

@@ -51,6 +51,7 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S
password: 'test',
},
...(config.admin || {}),
buildPath: path.resolve(__dirname, '../build'),
bundler: bundlerAdapters[process.env.PAYLOAD_BUNDLER || 'webpack'],
webpack: (webpackConfig) => {
const existingConfig =