Skip to content
This repository has been archived by the owner on Jun 2, 2022. It is now read-only.

Commit

Permalink
Revert "Attempts to use tree shaking css"
Browse files Browse the repository at this point in the history
This reverts commit 8f1b57d.
  • Loading branch information
eduardoformiga committed Jan 21, 2022
1 parent 8f1b57d commit 8ddb844
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 185 deletions.
40 changes: 3 additions & 37 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ const path = require('path')

const fs = require('fs-extra')

const { findLoader } = require('./src/utils')

exports.onPreInit = ({ reporter }) => {
reporter.info('Copying Partytown Files')

Expand All @@ -16,12 +14,12 @@ exports.onPreInit = ({ reporter }) => {
)
}

exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
exports.onCreateWebpackConfig = ({ actions: { setWebpackConfig }, stage }) => {
const profiling = process.env.GATSBY_STORE_PROFILING === 'true'

if (stage === 'build-javascript') {
if (profiling) {
actions.setWebpackConfig({
setWebpackConfig({
optimization: {
minimize: false,
moduleIds: 'named',
Expand All @@ -30,7 +28,7 @@ exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
},
})
} else {
actions.setWebpackConfig({
setWebpackConfig({
optimization: {
runtimeChunk: {
name: `webpack-runtime`,
Expand All @@ -47,39 +45,7 @@ exports.onCreateWebpackConfig = ({ actions, stage, getConfig }) => {
},
},
},
// module: {
// loaders: [
// {
// test: /\.(css|scss)$/,
// loader: 'dropcss-loader',
// },
// ],
// },
})

const config = getConfig()
const existingRules = config.module.rules

// const customLoader = {
// loader: 'dropcss-loader',
// // options: {},
// }

for (const rules of existingRules) {
for (const rule of rules.oneOf || []) {
if (Array.isArray(rule.use)) {
const index = findLoader(rule.use, /css-loader/)

// const loader = rule.use[index]
if (index !== -1) {
rule.sideEffects = false
}
// insertLoader(rule.use, index, loader)
}
}
}

actions.replaceWebpackConfig(config)
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@
"@graphql-codegen/cli": "^2.2.1",
"@graphql-codegen/typescript": "^2.2.4",
"@graphql-codegen/typescript-operations": "^2.1.8",
"@ianwalter/dropcss-loader": "^1.0.1",
"@testing-library/cypress": "^8.0.0",
"@types/cypress": "^1.1.3",
"@vtex/lighthouse-config": "^1.4.15",
"@vtex/prettier-config": "1.0.0",
"@vtex/tsconfig": "0.6.0",
"autoprefixer": "^10.4.0",
"axe-core": "^4.3.3",
"csso-loader": "^0.3.1",
"cypress-axe": "^0.13.0",
"cypress-wait-until": "^1.7.2",
"dotenv": "^8.2.0",
Expand Down
56 changes: 0 additions & 56 deletions src/utils.js

This file was deleted.

94 changes: 4 additions & 90 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2013,39 +2013,6 @@
resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45"
integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==

"@ianwalter/concat@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@ianwalter/concat/-/concat-1.0.0.tgz#e8e39100a6a5a99804054f0f2bb3847454ebf804"
integrity sha512-yGea1eViz13ZGDxZltTKK0EFjo2AVHzT7YyMT5c3vJktu5X0qLKw4G7ZAmEthdfIiLpSDCgSLce3v8SC4IaqKw==
dependencies:
"@ianwalter/fs" "^1.1.0"
globby "^9.2.0"
p-reduce "^2.1.0"

"@ianwalter/dropcss-loader@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@ianwalter/dropcss-loader/-/dropcss-loader-1.0.1.tgz#8c1da95f855bab58a22eea63e51a31bdc3cd99d5"
integrity sha512-7l9PqTKcKl4DEmq6CpzwfRpYUAr2IMXm7sA86KkltaBm519U6pjn1+0irhB5DXfGIjbWDkH104hwFeMH7qdNtQ==
dependencies:
"@ianwalter/concat" "^1.0.0"
dropcss "^1.0.5"
loader-utils "^1.2.3"

"@ianwalter/fs@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@ianwalter/fs/-/fs-1.1.0.tgz#d2b4dc8a5dd56a957645e10f09555d04ce96c045"
integrity sha512-eq3Kirw9wn270t4FiF7J6iz/+R4csinFgYl0903Zv1c3avKGoex2Zgdh4Nj1YwzKCn/pgdlsSbCjPC80tKTPcg==
dependencies:
"@ianwalter/subpub" "^2.0.0"

"@ianwalter/subpub@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@ianwalter/subpub/-/subpub-2.0.0.tgz#38addd121ae71a43b3e32c845d4c76354ae04e28"
integrity sha512-m3XpULJENDsMIB+h0m2FYpMbpKTBgl+DZGYFaLpRklPplZxHrqP5qNRy7snBJfySOA31eDSkRS8Kgb7xI4XTqw==
dependencies:
"@babel/runtime" "^7.3.1"
patrun "^1.0.0"

"@iarna/toml@^2.2.5":
version "2.2.5"
resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c"
Expand Down Expand Up @@ -5513,14 +5480,6 @@ css-select@^4.1.3:
domutils "^2.6.0"
nth-check "^2.0.0"

[email protected]:
version "1.0.0-alpha.29"
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.29.tgz#3fa9d4ef3142cbd1c301e7664c1f352bd82f5a39"
integrity sha512-sRNb1XydwkW9IOci6iB2xmy8IGCj6r/fr+JWitvJ2JxQRPzN3T4AGGVWCMlVmVwM1gtgALJRmGIlWv5ppnGGkg==
dependencies:
mdn-data "~1.1.0"
source-map "^0.5.3"

css-tree@^1.1.2, css-tree@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.1.3.tgz#eb4870fb6fd7707327ec95c2ff2ab09b5e8db91d"
Expand Down Expand Up @@ -5609,21 +5568,6 @@ cssnano@^5.0.0:
lilconfig "^2.0.3"
yaml "^1.10.2"

csso-loader@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/csso-loader/-/csso-loader-0.3.1.tgz#2401a8c825a079ec243e2654e355562201a8a6d4"
integrity sha1-JAGoyCWgeewkPiZU41VWIgGoptQ=
dependencies:
csso "^3.0.1"
loader-utils "^1.1.0"

csso@^3.0.1:
version "3.5.1"
resolved "https://registry.yarnpkg.com/csso/-/csso-3.5.1.tgz#7b9eb8be61628973c1b261e169d2f024008e758b"
integrity sha512-vrqULLffYU1Q2tLdJvaCYbONStnfkfimRxXNaGjxMldI0C7JPBC4rB1RyjhfdZ4m1frm8pM9uRPKH3d2knZ8gg==
dependencies:
css-tree "1.0.0-alpha.29"

csso@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/csso/-/csso-4.2.0.tgz#ea3a561346e8dc9f546d6febedd50187cf389529"
Expand Down Expand Up @@ -6189,11 +6133,6 @@ dotenv@^8.2.0:
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"
integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==

dropcss@^1.0.5:
version "1.0.16"
resolved "https://registry.yarnpkg.com/dropcss/-/dropcss-1.0.16.tgz#d538dbc278832f17cc1e8a8dcb0090cac8509525"
integrity sha512-QgA6BUh2SoBYE/dSuMmeGhNdoGtGewt3Rn66xKyXoGNyjrKRXf163wuM+xeQ83p87l/3ALoB6Il1dgKyGS5pEw==

dset@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/dset/-/dset-3.1.1.tgz#07de5af7a8d03eab337ad1a8ba77fe17bba61a8c"
Expand Down Expand Up @@ -8206,13 +8145,6 @@ getpass@^0.1.1:
dependencies:
assert-plus "^1.0.0"

[email protected]:
version "0.3.0"
resolved "https://registry.yarnpkg.com/gex/-/gex-0.3.0.tgz#217324ccd6e5c61d2485c913eb7614b21358b97f"
integrity sha512-A1F2DMZUAnieFmVowt1QHcH7AJQZApRThR+z4C0GlzMGi6VYUAf9UvQdxODiCajGPGSRso86YJQ48E8+b5CBAQ==
dependencies:
lodash "4.17"

git-up@^4.0.5:
version "4.0.5"
resolved "https://registry.yarnpkg.com/git-up/-/git-up-4.0.5.tgz#e7bb70981a37ea2fb8fe049669800a1f9a01d759"
Expand Down Expand Up @@ -8356,7 +8288,7 @@ globby@^10.0.1:
merge2 "^1.2.3"
slash "^3.0.0"

globby@^9.0.0, globby@^9.2.0:
globby@^9.0.0:
version "9.2.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d"
integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==
Expand Down Expand Up @@ -10310,7 +10242,7 @@ [email protected]:
emojis-list "^3.0.0"
json5 "^2.1.2"

loader-utils@^1.1.0, loader-utils@^1.2.3, loader-utils@^1.4.0:
loader-utils@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613"
integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA==
Expand Down Expand Up @@ -10513,7 +10445,7 @@ lodash.without@^4.4.0:
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw=

[email protected], [email protected].21, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@~4.17.0:
[email protected], lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@~4.17.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
Expand Down Expand Up @@ -10838,11 +10770,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.14.tgz#7113fc4281917d63ce29b43446f701e68c25ba50"
integrity sha512-dn6wd0uw5GsdswPFfsgMp5NSB0/aDe6fK94YJV/AJDYXL6HVLWBsxeq7js7Ad+mU2K9LAlwpk6kN2D5mwCPVow==

mdn-data@~1.1.0:
version "1.1.4"
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-1.1.4.tgz#50b5d4ffc4575276573c4eedb8780812a8419f01"
integrity sha512-FSYbp3lyKjyj3E7fMl6rYvUdX0FBXaluGqlFoYESWQlyUTq8R+wp0rkFxoYFqZlHCvsUXGjyJmLQSnXToYhOSA==

meant@^1.0.1, meant@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/meant/-/meant-1.0.3.tgz#67769af9de1d158773e928ae82c456114903554c"
Expand Down Expand Up @@ -12039,11 +11966,6 @@ p-queue@^6.4.0:
eventemitter3 "^4.0.4"
p-timeout "^3.2.0"

p-reduce@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-2.1.0.tgz#09408da49507c6c274faa31f28df334bc712b64a"
integrity sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==

p-throttle@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/p-throttle/-/p-throttle-4.1.1.tgz#80b1fbd358af40a8bfa1667f9dc8b72b714ad692"
Expand Down Expand Up @@ -12344,14 +12266,6 @@ path-type@^4.0.0:
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==

patrun@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/patrun/-/patrun-1.0.0.tgz#c50a2174e3e02afe7fbc35d16e658d21c66a1e66"
integrity sha512-oemWSuxjb27nPkREl88BxZ2EFDFUKSPace+zYZjFKj2xFn6w/LgDFGptgQvme384As2gpEFIv4WMVE1cb9lDXQ==
dependencies:
gex "0.3"
lodash "4.17"

pbkdf2@^3.0.3:
version "3.1.2"
resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075"
Expand Down Expand Up @@ -14545,7 +14459,7 @@ [email protected], source-map@^0.7.3, source-map@~0.7.2:
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383"
integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==

source-map@^0.5.0, source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.3:
source-map@^0.5.0, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.3:
version "0.5.7"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc"
integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=
Expand Down

0 comments on commit 8ddb844

Please sign in to comment.