Skip to content

Commit

Permalink
u turn on esbuild for now
Browse files Browse the repository at this point in the history
  • Loading branch information
ob6160 committed Jul 23, 2021
1 parent 8c56ce4 commit 50f7661
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 90 deletions.
56 changes: 10 additions & 46 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,11 @@


const { ESBuildMinifyPlugin } = require('esbuild-loader');

function useEsbuildMinify(config, options) {
const { minimizer } = config.optimization;
const terserIndex = minimizer.findIndex(
minifier => minifier.constructor.name === 'TerserPlugin',
);

minimizer.splice(terserIndex, 1, new ESBuildMinifyPlugin(options));
}

function useEsbuildLoader(config, options) {
const { rules } = config.module;
const babelIndex = rules.findIndex(rule => rule.test.test('.js'));

rules[babelIndex].use = {
loader: 'esbuild-loader',
options,
};
}

module.exports = {
webpack: (config, { webpack }) => {
config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
});

config.plugins.push(
new webpack.ProvidePlugin({
React: 'react',
}),
);

useEsbuildMinify(config);
useEsbuildLoader(config, {
// Specify `tsx` if you're using TypeScript
loader: 'tsx',
target: 'es2017',
});

return config;
},
};
webpack: (config, { isServer }) => {
config.module.rules.push({
test: /\.(graphql|gql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader',
});
return config;
},

}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
"cli-progress": "3.9.0",
"customize-cra": "1.0.0",
"dotenv": "10.0.0",
"esbuild-loader": "2.13.1",
"geojson-precision": "1.0.0",
"http-proxy-middleware": "2.0.0",
"husky": "6.0.0",
Expand Down
43 changes: 0 additions & 43 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4582,24 +4582,6 @@ es6-promise@^4.2.8:
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a"
integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==

esbuild-loader@2.13.1:
version "2.13.1"
resolved "https://registry.yarnpkg.com/esbuild-loader/-/esbuild-loader-2.13.1.tgz#9c89e654390a9a25d99b2f6d803ade30f4335418"
integrity sha512-Tzc5nB5tVUmigXz6m4j1OYozJCjdix7E9vtd5RaE54fqz2Rz34Is9S8FbAf8uqR4xvQUBAXIi6Jkn1OeMxw2aQ==
dependencies:
esbuild "^0.11.19"
joycon "^3.0.1"
json5 "^2.2.0"
loader-utils "^2.0.0"
tapable "^2.2.0"
type-fest "^1.0.1"
webpack-sources "^2.2.0"

esbuild@^0.11.19:
version "0.11.23"
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.11.23.tgz#c42534f632e165120671d64db67883634333b4b8"
integrity sha512-iaiZZ9vUF5wJV8ob1tl+5aJTrwDczlvGP0JoMmnpC2B0ppiMCu8n8gmy5ZTGl5bcG081XBVn+U+jP+mPFm5T5Q==

escalade@^3.0.2, escalade@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"
Expand Down Expand Up @@ -6838,11 +6820,6 @@ jose@^2.0.5:
dependencies:
"@panva/asn1.js" "^1.0.0"

joycon@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.0.1.tgz#9074c9b08ccf37a6726ff74a18485f85efcaddaf"
integrity sha512-SJcJNBg32dGgxhPtM0wQqxqV0ax9k/9TaUskGDSJkSFSQOEWWvQ3zzWdGQRIUry2j1zA5+ReH13t0Mf3StuVZA==

js-cookie@^2.2.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/js-cookie/-/js-cookie-2.2.1.tgz#69e106dc5d5806894562902aa5baec3744e9b2b8"
Expand Down Expand Up @@ -6912,13 +6889,6 @@ json5@^2.1.2:
dependencies:
minimist "^1.2.5"

json5@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3"
integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==
dependencies:
minimist "^1.2.5"

jsonfile@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.0.1.tgz#98966cba214378c8c84b82e085907b40bf614179"
Expand Down Expand Up @@ -11581,11 +11551,6 @@ type-fest@^0.8.0, type-fest@^0.8.1:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d"
integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==

type-fest@^1.0.1:
version "1.2.2"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.2.2.tgz#1930bc36b2064f7ab4aa307a6d1b65965199c698"
integrity sha512-pfkPYCcuV0TJoo/jlsUeWNV8rk7uMU6ocnYNvca1Vu+pyKi8Rl8Zo2scPt9O72gCsXIm+dMxOOWuA3VFDSdzWA==

type-fest@^1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.1.3.tgz#ea1a602e98e5a968a56a289886a52f04c686fc81"
Expand Down Expand Up @@ -12127,14 +12092,6 @@ webpack-sources@^2.0.1:
source-list-map "^2.0.1"
source-map "^0.6.1"

webpack-sources@^2.2.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.1.tgz#570de0af163949fe272233c2cefe1b56f74511fd"
integrity sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==
dependencies:
source-list-map "^2.0.1"
source-map "^0.6.1"

webpack-sources@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.0.tgz#9ed2de69b25143a4c18847586ad9eccb19278cfa"
Expand Down

0 comments on commit 50f7661

Please sign in to comment.