Skip to content

Commit

Permalink
fix: fix production build, also speed up builds
Browse files Browse the repository at this point in the history
  • Loading branch information
Anidetrix committed Mar 29, 2020
1 parent 7a600c3 commit b5b2e4f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
5 changes: 4 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ module.exports = api => {
api.cache.invalidate(() => process.env.NODE_ENV === "production");

const presets = [["@babel/preset-env", { modules: false, targets: { node: "10" } }]];
const plugins = [["@babel/plugin-transform-runtime", { useESModules: true }]];
const plugins = [
"transform-node-env-inline",
["@babel/plugin-transform-runtime", { useESModules: true }],
];

if (api.env("test")) presets[0][1].modules = "commonjs";

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@rollup/plugin-replace": "^2.3.1",
"@types/cssnano": "^4.0.0",
"@types/fs-extra": "^8.1.0",
"@types/icss-utils": "^4.1.0",
Expand All @@ -67,6 +66,7 @@
"@wessberg/rollup-plugin-ts": "^1.2.22",
"autoprefixer": "^9.7.5",
"babel-jest": "^25.2.3",
"babel-plugin-transform-node-env-inline": "^0.4.3",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-import-resolver-node": "^0.3.3",
Expand Down
2 changes: 0 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json from "@rollup/plugin-json";
import replace from "@rollup/plugin-replace";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import autoExternal from "rollup-plugin-auto-external";
Expand All @@ -21,7 +20,6 @@ export default [
plugins: [
autoExternal(),
json(),
replace({ "process.env.NODE_ENV": JSON.stringify(prod ? "production" : "development") }),
resolve({
preferBuiltins: true,
extensions: [".ts", ".mjs", ".js", ".json"],
Expand Down
15 changes: 6 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1138,14 +1138,6 @@
is-module "^1.0.0"
resolve "^1.14.2"

"@rollup/plugin-replace@^2.3.1":
version "2.3.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-replace/-/plugin-replace-2.3.1.tgz#16fb0563628f9e6c6ef9e05d48d3608916d466f5"
integrity sha512-qDcXj2VOa5+j0iudjb+LiwZHvBRRgWbHPhRmo1qde2KItTjuxDVQO21rp9/jOlzKR5YO0EsgRQoyox7fnL7y/A==
dependencies:
"@rollup/pluginutils" "^3.0.4"
magic-string "^0.25.5"

"@rollup/pluginutils@^3.0.0", "@rollup/pluginutils@^3.0.4", "@rollup/pluginutils@^3.0.6", "@rollup/pluginutils@^3.0.8":
version "3.0.8"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.0.8.tgz#4e94d128d94b90699e517ef045422960d18c8fde"
Expand Down Expand Up @@ -1773,6 +1765,11 @@ babel-plugin-jest-hoist@^25.2.1:
dependencies:
"@types/babel__traverse" "^7.0.6"

babel-plugin-transform-node-env-inline@^0.4.3:
version "0.4.3"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-node-env-inline/-/babel-plugin-transform-node-env-inline-0.4.3.tgz#8c84cd74d58f17b0fdf76144a3589f610c3c2497"
integrity sha1-jITNdNWPF7D992FEo1ifYQw8JJc=

babel-polyfill@6.26.0, babel-polyfill@^6.3.14:
version "6.26.0"
resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153"
Expand Down Expand Up @@ -5111,7 +5108,7 @@ lunr@^2.3.8:
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.8.tgz#a8b89c31f30b5a044b97d2d28e2da191b6ba2072"
integrity sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg==

magic-string@^0.25.2, magic-string@^0.25.5, magic-string@^0.25.7:
magic-string@^0.25.2, magic-string@^0.25.7:
version "0.25.7"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051"
integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==
Expand Down

0 comments on commit b5b2e4f

Please sign in to comment.