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

chore: Removes SWC compilation pipeline in prep for RSPack #14903

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
.env
.env.*
!.env.development
.swc/
.yalc
*.csv
*.dat
Expand Down
36 changes: 0 additions & 36 deletions .swcrc.js

This file was deleted.

35 changes: 0 additions & 35 deletions HACKS.md

This file was deleted.

11 changes: 1 addition & 10 deletions __mocks__/@loadable/component.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import React from "react"

async function loadable(load, { resolveComponent }) {
let Component

// If running jest using babel, lean on babel-plugin-loadable
// TODO: Remove this when we fully switch to SWC
if (load.requireSync) {
Component = resolveComponent(load.requireSync())
// Using SWC compiler, no transform; load like normal
} else {
Component = resolveComponent(await load())
}
let Component = resolveComponent(load.requireSync())

const Loadable = props => {
return <Component {...props} />
Expand Down
132 changes: 0 additions & 132 deletions coffeelint.json

This file was deleted.

9 changes: 1 addition & 8 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
const swcConfig = require("./.swcrc.js")
const { webpackEnv } = require("./webpack/webpackEnv")

if (webpackEnv.experimentalSWCCompiler) {
console.log("[jest.config.js] Experimental SWC Compiler is enabled.\n")
}

module.exports = {
cacheDirectory: ".cache/jest",
moduleDirectories: ["node_modules", "<rootDir>/src"],
Expand All @@ -25,9 +20,7 @@ module.exports = {
},
transform: {
"\\.(gql|graphql)$": "@graphql-tools/jest-transform",
"(ts|tsx|js|jsx)$": webpackEnv.experimentalSWCCompiler
? ["@swc/jest", swcConfig]
: "babel-jest",
"(ts|tsx|js|jsx)$": "babel-jest",
},
watchPlugins: [
"jest-watch-typeahead/filename",
Expand Down
1 change: 0 additions & 1 deletion jest.legacy.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const swcConfig = require("./.swcrc.js")
const { webpackEnv } = require("./webpack/webpackEnv")

module.exports = {
Expand Down
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,6 @@
"@storybook/builder-webpack5": "6.5.13",
"@storybook/manager-webpack5": "6.5.13",
"@storybook/react": "6.5.13",
"@swc/core": "^1.3.95",
"@swc/jest": "^0.2.29",
"@swc/plugin-relay": "^1.5.94",
"@swc/plugin-styled-components": "^1.5.94",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/react-hooks": "^8.0.1",
Expand Down Expand Up @@ -337,7 +333,6 @@
"size-plugin": "^3.0.0",
"storybook-states": "1.2.0",
"style-loader": "0.23.1",
"swc-loader": "^0.2.3",
"terser-webpack-plugin": "5.1.3",
"time-fix-plugin": "^2.0.7",
"typescript": "^5.6.3",
Expand Down
1 change: 0 additions & 1 deletion scripts/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -ex

rm -rf .cache
rm -rf .swc
rm -f manifest.json
rm -rf public
mkdir public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ describe("Two factor authentication enrollment", () => {
expect(downloadButton.text()).toBe("Download")
})

// FIXME: SWC_COMPILER_MIGRATION
it.skip("enables user to download the recovery codes", () => {
it("enables user to download the recovery codes", () => {
global.URL.createObjectURL = jest.fn()
global.URL.revokeObjectURL = jest.fn()

Expand Down
6 changes: 2 additions & 4 deletions src/System/Router/Utils/collectAssets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export const collectAssets = async ({

const initialRelayData = await relaySSRMiddleware.getCache()

console.log(initialRelayData)

const extractScriptTags = () => {
const initialScripts: string[] = []

Expand All @@ -79,10 +81,6 @@ export const collectAssets = async ({
bundleScriptTags
.split("\n")
.map(script => {
/**
* In production, prefix injected script src with CDN endpoint.
* @see https://github.com/artsy/force/blob/main/src/lib/middleware/asset.ts#L23
*/
if (getENV("CDN_URL")) {
const scriptTagWithCDN = script.replace(
/src="\/assets/g,
Expand Down
12 changes: 2 additions & 10 deletions webpack/envs/clientDevelopmentConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import webpack from "webpack"
import { basePath, webpackEnv } from "../webpackEnv"
import { splitChunks } from "../bundleSplitting"
import { sharedPlugins } from "../sharedPlugins"
import { babelLoader, ejsLoader, mjsLoader, swcLoader } from "../sharedLoaders"
import { babelLoader, ejsLoader, mjsLoader } from "../sharedLoaders"

import {
cache,
Expand All @@ -26,10 +26,6 @@ import {

console.log("\n[Force] Building client-side development code...\n")

if (webpackEnv.experimentalSWCCompiler) {
console.log("[Force] Experimental SWC Compiler is enabled.\n")
}

export const clientDevelopmentConfig = () => {
return {
cache,
Expand All @@ -44,11 +40,7 @@ export const clientDevelopmentConfig = () => {
externals,
mode,
module: {
rules: [
webpackEnv.experimentalSWCCompiler ? swcLoader : babelLoader,
ejsLoader,
mjsLoader,
],
rules: [babelLoader, ejsLoader, mjsLoader],
},
optimization: {
runtimeChunk: "single", // Extract webpack runtime code into it's own file
Expand Down
12 changes: 0 additions & 12 deletions webpack/sharedLoaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

import path from "path"
import { basePath, webpackEnv } from "./webpackEnv"
import swcConfig from "../.swcrc.js"

export const swcLoader = {
include: path.resolve(basePath, "src"),
test: /(\.(js|ts)x?$)/,
use: [
{
loader: "swc-loader",
options: swcConfig,
},
],
}

export const babelLoader = {
exclude: /(node_modules)/,
Expand Down
3 changes: 0 additions & 3 deletions webpack/webpackEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ loadEnvs(".env.shared", ".env")
const webpackEnv = {
isDevelopment: process.env.NODE_ENV === "development",
isProduction: process.env.NODE_ENV === "production",
experimentalSWCCompiler:
process.env.EXPERIMENTAL_SWC_COMPILER_ENABLED === "true",
}

const basePath = process.cwd()
Expand All @@ -24,7 +22,6 @@ if (process.env.CI || process.env.WEBPACK_LOG_CONFIG) {
console.log("\n[Webpack Environment]")
console.log(" basePath".padEnd(40), chalk.yellow(basePath))
console.log(" CI".padEnd(40), chalk.yellow(process.env.CI))
console.log(" EXPERIMENTAL_SWC_COMPILER_ENABLED".padEnd(40), chalk.yellow(webpackEnv.experimentalSWCCompiler))
console.log(" NODE_ENV".padEnd(40), chalk.yellow(process.env.NODE_ENV))
console.log(" WEBPACK_BUNDLE_REPORT".padEnd(40), chalk.yellow(process.env.WEBPACK_BUNDLE_REPORT))
console.log(" WEBPACK_DEVTOOL".padEnd(40), chalk.yellow(process.env.WEBPACK_DEVTOOL))
Expand Down
Loading