Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

breaking: remove webpack #10867

Merged
merged 73 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
cce3fc3
remove bundler config option
Josh-Walker-GM Jun 20, 2024
577c386
fix telemetry
Josh-Walker-GM Jun 20, 2024
a31f818
fix prerender
Josh-Walker-GM Jun 20, 2024
b6ffab0
fix babel config test
Josh-Walker-GM Jun 20, 2024
b390a71
skip webpack specific tests for a moment
Josh-Walker-GM Jun 20, 2024
4aededa
misc useVite removal
Josh-Walker-GM Jun 20, 2024
ba3b9b8
removal webpack storybook
Josh-Walker-GM Jun 20, 2024
48bb315
remove prebuildWebFile from babel-config
Josh-Walker-GM Jun 21, 2024
3fc031a
remove web build from internal
Josh-Walker-GM Jun 21, 2024
941585b
wip
Josh-Walker-GM Jun 21, 2024
def1b78
move build web into vite package
Josh-Walker-GM Jun 21, 2024
4d48458
remove build stats command flag
Josh-Walker-GM Jun 21, 2024
e655900
fix build handler
Josh-Walker-GM Jun 21, 2024
4f4687d
fix dev handler
Josh-Walker-GM Jun 21, 2024
2309c91
fix cli telemetry
Josh-Walker-GM Jun 21, 2024
a1ae10b
remove config from core package
Josh-Walker-GM Jun 21, 2024
df60267
remove testing/config/storybook
Josh-Walker-GM Jun 21, 2024
cb6f6bc
misc changes/comments
Josh-Walker-GM Jun 21, 2024
df78c11
remove webpack from vite setup handler
Josh-Walker-GM Jun 21, 2024
e883540
remove webpack setup command
Josh-Walker-GM Jun 21, 2024
c8df98f
remove webpack plugins
Josh-Walker-GM Jun 21, 2024
bab8b35
fix cli tests
Josh-Walker-GM Jun 21, 2024
9a2baec
update get paths for webpack and vite config
Josh-Walker-GM Jun 21, 2024
a7b3d72
remove webpack bin from web package
Josh-Walker-GM Jun 21, 2024
c36927e
remove custom web index setup command
Josh-Walker-GM Jun 21, 2024
09ae2b3
misc webpack removals/comments
Josh-Walker-GM Jun 21, 2024
ed519da
remove bundler options from tasks/ci
Josh-Walker-GM Jun 21, 2024
fcee30a
remove webpack/bundler config from CI
Josh-Walker-GM Jun 21, 2024
f776824
remove unneeded test
Josh-Walker-GM Jun 21, 2024
61fae84
remove webpack releated types deps from testing package
Josh-Walker-GM Jun 21, 2024
2897d5d
remove webpack related deps from core package
Josh-Walker-GM Jun 21, 2024
6276f9c
remove unneeded storybook provider from testing package
Josh-Walker-GM Jun 21, 2024
25c5b57
fix missing types for webpack shims
Josh-Walker-GM Jun 21, 2024
3d5a6fb
unbreak prerender
Josh-Walker-GM Jun 21, 2024
63c39ee
tmp: skip tests
Josh-Walker-GM Jun 21, 2024
a0c32c9
switch storybook smoke test command
Josh-Walker-GM Jun 21, 2024
5789e96
increase timeout
Josh-Walker-GM Jun 21, 2024
c05d2b1
unbreak test web command
Josh-Walker-GM Jun 21, 2024
aa34768
restore test snapshot value
Josh-Walker-GM Jun 21, 2024
ba59bfb
cli smoke test use storybook vite
Josh-Walker-GM Jun 21, 2024
a3606f7
slightly safer matching
Josh-Walker-GM Jun 21, 2024
c2563d1
remove comment
Josh-Walker-GM Jun 21, 2024
4bddd77
remove comment
Josh-Walker-GM Jun 21, 2024
b341ef9
remove comment
Josh-Walker-GM Jun 21, 2024
61d082f
remove comment
Josh-Walker-GM Jun 21, 2024
47effe0
remove comment
Josh-Walker-GM Jun 21, 2024
da63fd2
fix example
Josh-Walker-GM Jun 21, 2024
0abc198
fix comment
Josh-Walker-GM Jun 21, 2024
ab80325
remove index path
Josh-Walker-GM Jun 21, 2024
e05a948
update comment
Josh-Walker-GM Jun 21, 2024
536a377
remove comment
Josh-Walker-GM Jun 21, 2024
9f77c95
remove webpackChunkName
Josh-Walker-GM Jun 21, 2024
27cf4e0
remove webpack chunk name
Josh-Walker-GM Jun 21, 2024
d79f08b
semi fix tests/builds
Josh-Walker-GM Jun 21, 2024
24d5279
Update nestedPages tests
dac09 Jun 25, 2024
9179a7e
Merge remote-tracking branch 'origin/main' into jgmw/remove-webpack
Josh-Walker-GM Jun 25, 2024
e9b7d2e
add changesets entry
Josh-Walker-GM Jun 25, 2024
5a2d395
remove custom web index docs
Josh-Walker-GM Jun 25, 2024
1971cb0
remove builds docs
Josh-Walker-GM Jun 25, 2024
382a0be
remove cli custom index docs
Josh-Walker-GM Jun 25, 2024
6c6b374
misc cli docs updates
Josh-Walker-GM Jun 25, 2024
3949727
restore builds.md
Josh-Walker-GM Jun 25, 2024
43a0d46
Merge branch 'main' into jgmw/remove-webpack
Josh-Walker-GM Jun 26, 2024
e907376
Merge remote-tracking branch 'origin/main' into jgmw/remove-webpack
Josh-Walker-GM Jul 11, 2024
246aa4f
Merge branch 'main' into jgmw/remove-webpack
Josh-Walker-GM Jul 11, 2024
0b93639
Merge remote-tracking branch 'origin/main' into jgmw/remove-webpack
Josh-Walker-GM Jul 17, 2024
1add7a1
make fs-extra happy in test
Josh-Walker-GM Jul 17, 2024
7e46127
restore build exports field
Josh-Walker-GM Jul 17, 2024
a2ec5da
remove sb cli plugin defaults
Josh-Walker-GM Jul 17, 2024
2d94fac
make attw happy - doesn't make josh happy
Josh-Walker-GM Jul 18, 2024
9222d38
Merge branch 'main' into jgmw/remove-webpack
Josh-Walker-GM Jul 18, 2024
162f9dd
Merge branch 'main' into jgmw/remove-webpack
Josh-Walker-GM Jul 19, 2024
2820ab0
restore preset file
Josh-Walker-GM Jul 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .changesets/10867.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
- breaking: remove webpack (#10867) by @Josh-Walker-GM

This PR removes support for webpack.

---
To the person releasing, the follow are the breaking changes I have identified:
1. `prebuildWebFile` is function no longer exported from `@redwoodjs/babel-config` package
2. `@redwoodjs/cli-storybook` has been removed
3. `yarn rw build` no longer accepts the `--stats` flag
4. `yarn rw dev` no longer accepts the `--watchNodeModules` flag
5. `yarn rw setup custom-web-index` command has been removed
6. `yarn rw setup webpack` has been removed
7. `@redwoodjs/core` no longer provides `@redwoodjs/core/config/*` files
8. The `web.bundler` TOML config option has been removed
9. `@redwoodjs/testing` no longer provides storybook config files
10. `@redwoodjs/testing` no longer provides a `StorybookProvider`
11. The `webpack` bin has been removed from `@redwoodjs/web`
3 changes: 0 additions & 3 deletions .github/actions/set-up-test-project/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ runs:
main: 'setUpTestProject.mjs'

inputs:
bundler:
description: The bundler to use (vite or webpack)
default: vite
canary:
description: Upgrade the project to canary?
default: "false"
Expand Down
21 changes: 0 additions & 21 deletions .github/actions/set-up-test-project/setUpTestProject.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,8 @@ const TEST_PROJECT_PATH = path.join(

core.setOutput('test-project-path', TEST_PROJECT_PATH)

const bundler = core.getInput('bundler')

const canary = core.getInput('canary') === 'true'


console.log({
bundler,
canary
})

Expand Down Expand Up @@ -73,22 +68,6 @@ const execInProject = createExecWithEnvInCwd(TEST_PROJECT_PATH)
* @returns {Promise<void>}
*/
async function sharedTasks() {
console.log({ bundler })
console.log()

if (bundler === 'webpack') {
console.log(`Setting the bundler to ${bundler}`)
console.log()

const redwoodTOMLPath = path.join(TEST_PROJECT_PATH, 'redwood.toml')
const redwoodTOML = fs.readFileSync(redwoodTOMLPath, 'utf-8')
const redwoodTOMLWithWebpack = redwoodTOML.replace('[web]\n', '[web]\n bundler = "webpack"\n')
fs.writeFileSync(redwoodTOMLPath, redwoodTOMLWithWebpack)

// There's an empty line at the end of the redwood.toml file, so no need to console.log after.
console.log(fs.readFileSync(redwoodTOMLPath, 'utf-8'))
}

console.log('Generating dbAuth secret')
const { stdout } = await execInProject(
'yarn rw g secret --raw',
Expand Down
35 changes: 8 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ jobs:
tutorial-e2e:
needs: check

strategy:
matrix:
bundler: [vite, webpack]

name: 🌲 Tutorial E2E / ${{ matrix.bundler }} / node 20 latest
name: 🌲 Tutorial E2E / node 20 latest
runs-on: ubuntu-latest

steps:
Expand All @@ -148,7 +144,6 @@ jobs:
git config --global user.name "Your Name"

./tasks/run-e2e "$project_path" \
--bundler ${{ matrix.bundler }} \
--no-build-framework \
--no-start

Expand All @@ -173,7 +168,7 @@ jobs:
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ matrix.bundler }}-logs
name: logs
path: |
${{ steps.crwa.outputs.project-path }}/dev_server.log
${{ steps.crwa.outputs.project-path }}/e2e.log
Expand All @@ -182,11 +177,7 @@ jobs:
needs: detect-changes
if: needs.detect-changes.outputs.code == 'false'

strategy:
matrix:
bundler: [vite, webpack]

name: 🌲 Tutorial E2E / ${{ matrix.bundler }} / node 20 latest
name: 🌲 Tutorial E2E / node 20 latest
runs-on: ubuntu-latest

steps:
Expand All @@ -198,9 +189,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
bundler: [vite, webpack]

name: 🔄 Smoke tests / ${{ matrix.os }} / ${{ matrix.bundler }} / node 20 latest
name: 🔄 Smoke tests / ${{ matrix.os }} / node 20 latest
runs-on: ${{ matrix.os }}

env:
Expand All @@ -217,8 +207,6 @@ jobs:
- name: 🌲 Set up test project
id: set-up-test-project
uses: ./.github/actions/set-up-test-project
with:
bundler: ${{ matrix.bundler }}
env:
REDWOOD_DISABLE_TELEMETRY: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false
Expand Down Expand Up @@ -278,9 +266,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
bundler: [vite, webpack]

name: 🔄 Smoke tests / ${{ matrix.os }} / ${{ matrix.bundler }} / node 20 latest
name: 🔄 Smoke tests / ${{ matrix.os }} / node 20 latest
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -292,9 +279,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
bundler: [vite, webpack]

name: 🔄 Smoke tests React 18 / ${{ matrix.os }} / ${{ matrix.bundler }} / node 20 latest
name: 🔄 Smoke tests React 18 / ${{ matrix.os }} / node 20 latest
runs-on: ${{ matrix.os }}

env:
Expand Down Expand Up @@ -330,8 +316,6 @@ jobs:
- name: 🌲 Set up test project for React 18
id: set-up-test-project-react-18
uses: ./.github/actions/set-up-test-project
with:
bundler: ${{ matrix.bundler }}
env:
REDWOOD_DISABLE_TELEMETRY: 1
YARN_ENABLE_IMMUTABLE_INSTALLS: false
Expand Down Expand Up @@ -391,9 +375,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
bundler: [vite, webpack]

name: 🔄 Smoke tests React 18 / ${{ matrix.os }} / ${{ matrix.bundler }} / node 20 latest
name: 🔄 Smoke tests React 18 / ${{ matrix.os }} / node 20 latest
runs-on: ${{ matrix.os }}

steps:
Expand Down Expand Up @@ -446,7 +429,7 @@ jobs:
working-directory: ${{ steps.set-up-test-project.outputs.test-project-path }}

- name: Run "rw storybook"
run: yarn rw sb --smoke-test
run: yarn rw sbv --smoke-test
working-directory: ${{ steps.set-up-test-project.outputs.test-project-path }}

- name: Run "rw exec"
Expand Down Expand Up @@ -667,7 +650,6 @@ jobs:
id: set-up-test-project
uses: ./.github/actions/set-up-test-project
with:
bundler: vite
canary: true
env:
REDWOOD_DISABLE_TELEMETRY: 1
Expand Down Expand Up @@ -739,7 +721,6 @@ jobs:
id: set-up-test-project
uses: ./.github/actions/set-up-test-project
with:
bundler: vite
canary: true
env:
REDWOOD_DISABLE_TELEMETRY: 1
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/builds.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ Each lambda function in `./api/dist/functions` is parsed by zip-it-and-ship-it r

## Web

The web side of Redwood is packaged by Webpack into the `./web/dist` folder.
The web side of Redwood is built by Vite into the `./web/dist` folder.
28 changes: 4 additions & 24 deletions docs/docs/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Build for production.
yarn redwood build [side..]
```

We use Babel to transpile the api side into `./api/dist` and Webpack to package the web side into `./web/dist`.
We use Babel to transpile the api side into `./api/dist` and Vite to package the web side into `./web/dist`.

| Arguments & Options | Description |
| :------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -190,7 +190,7 @@ Start development servers for api and web.
yarn redwood dev [side..]
```

`yarn redwood dev api` starts the Redwood dev server and `yarn redwood dev web` starts the Webpack dev server with Redwood's config.
`yarn redwood dev api` starts the Redwood dev server and `yarn redwood dev web` starts the Vite dev server with Redwood's config.

| Argument | Description |
| :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
Expand All @@ -214,7 +214,7 @@ $ /redwood-app/node_modules/.bin/dev-server
15:04:51 api | ► http://localhost:8911/graphql/
```

Using `--forward` (alias `--fwd`), you can pass one or more Webpack Dev Server [config options](https://webpack.js.org/configuration/dev-server/). The following will run the dev server, set the port to `1234`, and disable automatic browser opening.
Using `--forward` (alias `--fwd`), you can pass one or more Vite Dev Server [config options](https://vitejs.dev/guide/cli#vite). The following will run the dev server, set the port to `1234`, and disable automatic browser opening.

```bash
~/redwood-app$ yarn redwood dev --fwd="--port=1234 --open=false"
Expand All @@ -226,7 +226,7 @@ You may need to access your dev application from a different host, like your mob
~/redwood-app$ yarn redwood dev --fwd="--allowed-hosts all"
```

For the full list of Webpack Dev Server settings, see [this documentation](https://webpack.js.org/configuration/dev-server/).
For the full list of Vite Dev Server settings, see [this documentation](https://vitejs.dev/guide/cli#vite).

For the full list of Server Configuration settings, see [this documentation](app-configuration-redwood-toml.md#api).

Expand Down Expand Up @@ -1756,7 +1756,6 @@ yarn redwood setup <category>
| `package` | Peform setup actions by running a third-party npm package |
| `tsconfig` | Add relevant tsconfig so you can start using TypeScript |
| `ui` | Set up a UI design or style library |
| `webpack` | Set up a webpack config file in your project so you can add custom config |

### setup auth

Expand Down Expand Up @@ -1788,25 +1787,6 @@ yarn redwood setup cache <client>
| `client` | Name of the client to configure, `memcached` or `redis` |
| `--force, -f` | Overwrite existing files |

### setup custom-web-index

:::warning This command only applies to projects using Webpack

As of v6, all Redwood projects use Vite by default.
When switching projects to Vite, we made the decision to add the the entry file, `web/src/entry.client.{jsx,tsx}`, back to projects.

:::

Redwood automatically mounts your `<App />` to the DOM, but if you want to customize how that happens, you can use this setup command to generate an `index.js` file in `web/src`.

```
yarn redwood setup custom-web-index
```

| Arguments & Options | Description |
| :------------------ | :----------------------- |
| `--force, -f` | Overwrite existing files |

### setup generator

Copies a given generator's template files to your local app for customization. The next time you generate that type again, it will use your custom template instead of Redwood's default.
Expand Down
51 changes: 0 additions & 51 deletions docs/docs/custom-web-index.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ module.exports = {
'contributing-walkthrough',
'cors',
'create-redwood-app',
'custom-web-index',
'data-migrations',
{
type: 'category',
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-providers/supabase/web/ambient.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-var */

declare global {
// Provided by Vite.config, or Webpack in the user's project
// Provided by Vite.config
var RWJS_ENV: {
RWJS_API_GRAPHQL_URL: string
/** URL or absolute path to serverless functions */
Expand Down
1 change: 0 additions & 1 deletion packages/babel-config/dist.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('dist', () => {
"getWebSideDefaultBabelConfig": [Function],
"getWebSideOverrides": [Function],
"parseTypeScriptConfigFiles": [Function],
"prebuildWebFile": [Function],
"registerApiSideBabelHook": [Function],
"registerBabel": [Function],
"registerWebSideBabelHook": [Function],
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-config/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { parseConfigFileTextToJson } from 'typescript'
import { getPaths } from '@redwoodjs/project-config'

import { getWebSideBabelPlugins } from './web'
import type { Flags as WebFlags } from './web'

const pkgJson = require('../package.json')

Expand All @@ -17,6 +18,7 @@ export interface RegisterHookOptions {
*/
plugins?: PluginItem[]
overrides?: TransformOptions['overrides']
options?: WebFlags
}

interface BabelRegisterOptions extends TransformOptions {
Expand Down Expand Up @@ -76,9 +78,7 @@ export const getCommonPlugins = (): Array<[string, PluginOptions]> => {
// It's related to yarn workspaces to be or not to be
export const getRouteHookBabelPlugins = () => {
return [
...getWebSideBabelPlugins({
forVite: true,
}),
...getWebSideBabelPlugins(),
[
'babel-plugin-module-resolver',
{
Expand Down
1 change: 0 additions & 1 deletion packages/babel-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export {
getWebSideBabelPresets,
getWebSideDefaultBabelConfig,
getWebSideOverrides,
prebuildWebFile,
registerWebSideBabelHook,
} from './web'

Expand Down
Loading
Loading