chore(suite-web-landing): fulfil image optimise plugin todo

This commit is contained in:
Tomáš Klíma
2022-03-04 15:53:50 +01:00
committed by Matěj Kříž
parent 65e2146845
commit 6cf5e648f7
5 changed files with 789 additions and 138 deletions

View File

@@ -1,49 +1,44 @@
const path = require('path');
const webpack = require('webpack');
const withOptimizedImages = require('next-optimized-images');
const withVideos = require('next-videos');
// Get Suite App version from the Suite package.json
const { suiteVersion } = require('../suite/package.json');
const { dependencies } = require('./package.json');
// we definitely wan't to transpile all our local packages
// we definitely want to transpile all our local packages
const localPackages = Object.keys(dependencies).filter(packageName =>
packageName.match(/^@trezor/),
);
const withTranspileModules = require('next-transpile-modules')(localPackages);
module.exports = withTranspileModules(
withVideos(
withOptimizedImages({
images: {
disableStaticImages: true, // https://exerror.com/nextjs-typeerror-unsupported-file-type-undefined-after-update-to-v-11/
},
optimizeImages: false, // TODO: install optimization plugin and enable https://github.com/cyrilwanner/next-optimized-images#optimization-packages
typescript: {
// there is no possibility of error because TSC typecheck is run before build
// also this probably won't work correctly with project references
ignoreDevErrors: true,
ignoreBuildErrors: true,
},
compiler: {
styledComponents: true,
},
inlineImageLimit: 0,
// https://github.com/zeit/next.js/issues/6219
// target: 'serverless',
trailingSlash: true,
assetPrefix: process.env.ASSET_PREFIX || '',
webpack: (config, options) => {
config.plugins.push(
new webpack.DefinePlugin({
'process.env.VERSION': JSON.stringify(suiteVersion),
'process.env.ASSET_PREFIX': JSON.stringify(process.env.ASSET_PREFIX),
}),
);
withOptimizedImages({
images: {
disableStaticImages: true, // https://exerror.com/nextjs-typeerror-unsupported-file-type-undefined-after-update-to-v-11/
},
typescript: {
// there is no possibility of error because TSC typecheck is run before build
// also this probably won't work correctly with project references
ignoreDevErrors: true,
ignoreBuildErrors: true,
},
compiler: {
styledComponents: true,
},
inlineImageLimit: 0,
// https://github.com/zeit/next.js/issues/6219
// target: 'serverless',
trailingSlash: true,
assetPrefix: process.env.ASSET_PREFIX || '',
webpack: config => {
config.plugins.push(
new webpack.DefinePlugin({
'process.env.VERSION': JSON.stringify(suiteVersion),
'process.env.ASSET_PREFIX': JSON.stringify(process.env.ASSET_PREFIX),
}),
);
return config;
},
}),
),
return config;
},
}),
);

View File

@@ -23,8 +23,9 @@
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react-redux": "^7.1.7",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^10.0.1",
"next-optimized-images": "^2.6.2",
"next-transpile-modules": "^9.0.0",
"next-videos": "^1.4.0"
"next-transpile-modules": "^9.0.0"
}
}

View File

@@ -1,5 +1,7 @@
# Patches
## ripple-lib
## redux-thunk
## dropbox
@@ -13,3 +15,7 @@ Patch for app-builder-lib which is a package from [electron-builder](https://git
The reason of this patch is to sign `.dll` binary files inside the directory `swiftshader` in the `.exe` for windows in order to satisfy AppLocker policy.
There is a [PR](https://github.com/electron-userland/electron-builder/pull/6682) to the upstream electron-builder that was merged and will be included in next release that will make this patch unnecessary.
## imagemin-svgo
https://github.com/imagemin/imagemin-svgo/pull/57

View File

@@ -0,0 +1,22 @@
diff --git a/node_modules/imagemin-svgo/package.json b/node_modules/imagemin-svgo/package.json
index e45d9e7..97fd641 100644
--- a/node_modules/imagemin-svgo/package.json
+++ b/node_modules/imagemin-svgo/package.json
@@ -5,7 +5,7 @@
"license": "MIT",
"repository": "imagemin/imagemin-svgo",
"type": "module",
- "exports": "./index.js",
+ "exports": "./index.cjs",
"funding": {
"url": "https://github.com/sindresorhus/imagemin-svgo?sponsor=1"
},
@@ -16,7 +16,7 @@
"test": "xo && ava"
},
"files": [
- "index.js"
+ "index.cjs"
],
"keywords": [
"compress",

831
yarn.lock

File diff suppressed because it is too large Load Diff