Skip to content

Commit

Permalink
Use vite unless bundler === webpack (#8731)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Choudhury <dannychoudhury@gmail.com>
  • Loading branch information
Tobbe and dac09 authored Jun 26, 2023
1 parent 9547319 commit 619977f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/commands/__tests__/dev.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ describe('yarn rw dev', () => {

// Uses absolute path, so not doing a snapshot
expect(webCommand.command).toContain(
'yarn cross-env NODE_ENV=development RWJS_WATCH_NODE_MODULES= webpack serve'
'yarn cross-env NODE_ENV=development rw-vite-dev'
)

expect(apiCommand.command).toMatchInlineSnapshot(
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/buildHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const handler = async ({
side.includes('web') && {
title: 'Building Web...',
task: async () => {
if (getConfig().web.bundler === 'vite') {
if (getConfig().web.bundler !== 'webpack') {
// @NOTE: we're using the vite build command here, instead of the buildWeb function
// because we want the process.cwd to be the web directory, not the root of the project
// This is important for postcss/tailwind to work correctly
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/devHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export const handler = async ({
const redwoodConfigPath = getConfigPath()

const webCommand =
redwoodProjectConfig.web.bundler === 'vite' // @NOTE: can't use enums, not TS
redwoodProjectConfig.web.bundler !== 'webpack' // @NOTE: can't use enums, not TS
? `yarn cross-env NODE_ENV=development rw-vite-dev ${forward}`
: `yarn cross-env NODE_ENV=development RWJS_WATCH_NODE_MODULES=${
watchNodeModules ? '1' : ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function (
const importConstName = getVariableName(p)
let copiedAssetPath

if (bundler === BundlerEnum.VITE) {
if (bundler !== BundlerEnum.WEBPACK) {
if (state.filename === undefined) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion packages/prerender/src/runPrerender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export const runPrerender = async ({
})

const gqlHandler = await getGqlHandler()
const vite = getConfig().web.bundler === 'vite'
const vite = getConfig().web.bundler !== 'webpack'

// Prerender specific configuration
// extends projects web/babelConfig
Expand Down

0 comments on commit 619977f

Please sign in to comment.