Skip to content

Commit

Permalink
chore(webpack): optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Jun 2, 2022
1 parent 0042b09 commit 808e27b
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 14 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@artsy/backbone-mixins": "3.0.0",
"@artsy/cohesion": "4.51.0",
"@artsy/eigen-web-association": "1.5.1",
"@artsy/express-reloadable": "1.6.0",
"@artsy/express-reloadable": "^1.7.0",
"@artsy/fresnel": "3.5.0",
"@artsy/gemup": "0.1.0",
"@artsy/multienv": "^1.2.0",
Expand Down Expand Up @@ -398,6 +398,7 @@
"stylus-loader": "3.0.2",
"supertest": "2.0.1",
"terser-webpack-plugin": "5.1.3",
"time-fix-plugin": "^2.0.7",
"typescript": "4.7.2",
"typescript-styled-plugin": "0.15.0",
"vscode-apollo-relay": "1.5.2",
Expand Down
8 changes: 1 addition & 7 deletions src/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,7 @@ mountAndReload(path.resolve("src/v2/server.ts"), {

// Mount express-reloadable on legacy routes
mountAndReload(path.resolve("src/desktop"), {
watchModules: [
path.resolve(process.cwd(), "src/v2"),
"@artsy/cohesion",
"@artsy/fresnel",
"@artsy/palette",
"@artsy/stitch",
],
watchModules: ["@artsy/palette"],
})

// Start server
Expand Down
1 change: 0 additions & 1 deletion src/v2/Apps/Home/HomeApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export const HomeApp: React.FC<HomeAppProps> = ({
homePage,
featuredEventsOrderedSet,
}) => {
console.log("hi")
return (
<>
<HomeMeta />
Expand Down
9 changes: 9 additions & 0 deletions webpack/envs/clientDevelopmentConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import HtmlWebpackPlugin from "html-webpack-plugin"
import LoadablePlugin from "@loadable/webpack-plugin"
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin"
import SimpleProgressWebpackPlugin from "simple-progress-webpack-plugin"
import TimeFixPlugin from "time-fix-plugin"
import { WebpackManifestPlugin } from "webpack-manifest-plugin"
import ForkTsCheckerWebpackPlugin from "fork-ts-checker-webpack-plugin"
import path from "path"
Expand Down Expand Up @@ -51,11 +52,18 @@ export const clientDevelopmentConfig = () => ({
concatenateModules: env.webpackConcatenate,
runtimeChunk: "single", // Extract webpack runtime code into it's own file
splitChunks,

// Webpack does extra algorithmic work to optimize the output for size and
// load performance. These optimizations are performant for smaller codebases,
// but can be costly in larger ones.
removeAvailableModules: env.isDevelopment,
removeEmptyChunks: env.isDevelopment,
},
output: {
filename: "[name].js",
path: path.resolve(basePath, "public/assets"),
publicPath: "/assets/",
pathinfo: false,
},
plugins: [
...sharedPlugins(),
Expand Down Expand Up @@ -84,6 +92,7 @@ export const clientDevelopmentConfig = () => ({
new SimpleProgressWebpackPlugin({
format: "minimal",
}),
new TimeFixPlugin(),
new WebpackManifestPlugin({
basePath: "/assets/",
fileName: path.resolve(basePath, "manifest-novo.json"),
Expand Down
2 changes: 1 addition & 1 deletion webpack/envs/splitChunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const FRAMEWORK_BUNDLES = ["react", "react-dom", "@sentry"]
const TOTAL_PAGES = 12

export const splitChunks = {
chunks: "all",
automaticNameDelimiter: "-",
chunks: "all",
cacheGroups: {
default: false,
defaultVendors: false,
Expand Down
1 change: 1 addition & 0 deletions webpack/utils/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ if (env.onCi || env.logConfig) {
console.log(" BUILD_SERVER".padEnd(35), chalk.yellow(env.buildServer))
console.log(" BUILD_CLIENT".padEnd(35), chalk.yellow(env.buildClient))
console.log(" CI".padEnd(35), chalk.yellow(env.onCi))
console.log(" COMPILE_LEGACY_CLIENT_IN_DEV".padEnd(35), chalk.yellow(env.compileLegacyClientInDev))
console.log(" NODE_ENV == 'isDevelopment'".padEnd(35), chalk.yellow(env.isDevelopment))
console.log(" NODE_ENV == 'isProduction'".padEnd(35), chalk.yellow(env.isProduction))
console.log(" NODE_ENV == 'isStaging'".padEnd(35), chalk.yellow(env.isStaging))
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
dependencies:
express "^4.15.0"

"@artsy/express-reloadable@1.6.0":
version "1.6.0"
resolved "https://registry.yarnpkg.com/@artsy/express-reloadable/-/express-reloadable-1.6.0.tgz#5660febfa07d4c7ea5a838878ae61b906fd10c0d"
integrity sha512-UVUn6s1D38mO1s711JPkvG1uy0fkVy504TpLnl745hbF2TtACv/I52hwFv1xISGdyz8rvQreYYHcXjkZvzmsnw==
"@artsy/express-reloadable@^1.7.0":
version "1.7.0"
resolved "https://registry.yarnpkg.com/@artsy/express-reloadable/-/express-reloadable-1.7.0.tgz#af8f93aea5ad8cf6ebb90d9be484c3e19269ffb6"
integrity sha512-a8PQ6NGjSP+T7S/Ll4Z53SUdqG7K1QGg4jr5gnjClEKRQWAmr2HLxu0Dr+XLtYjYwJbqUtQg48WtJrf49OPaZw==
dependencies:
chalk "^2.3.1"
chokidar "^3.0.0"
Expand Down Expand Up @@ -21347,6 +21347,11 @@ through@^2.3.6, through@^2.3.8, through@~2.3.4, through@~2.3.8:
resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5"
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=

time-fix-plugin@^2.0.7:
version "2.0.7"
resolved "https://registry.yarnpkg.com/time-fix-plugin/-/time-fix-plugin-2.0.7.tgz#4ba70ae2e40cedf34dabe505eda7b71b1b244f50"
integrity sha512-uVFet1LQToeUX0rTcSiYVYVoGuBpc8gP/2jnlUzuHMHe+gux6XLsNzxLUweabMwiUj5ejhoIMsUI55nVSEa/Vw==

timed-out@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/timed-out/-/timed-out-4.0.1.tgz#f32eacac5a175bea25d7fab565ab3ed8741ef56f"
Expand Down

0 comments on commit 808e27b

Please sign in to comment.