@csssr/core-scripts
Advanced tools
+2
-2
| { | ||
| "name": "@csssr/core-scripts", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "main": "index.js", | ||
@@ -22,3 +22,3 @@ "license": "MIT", | ||
| }, | ||
| "gitHead": "5ea8f28b704d141ebaa53e3a30803dd41a8eef4b" | ||
| "gitHead": "472c892dc13043fe3efd939c5800ae704b73172e" | ||
| } |
@@ -5,61 +5,88 @@ const withPlugins = require('next-compose-plugins') | ||
| const svgrLoaderConfig = { | ||
| loader: '@svgr/webpack', | ||
| options: { | ||
| svgoConfig: { | ||
| plugins: [ | ||
| { inlineStyles: false }, | ||
| { prefixIds: false }, | ||
| { | ||
| cleanupNumericValues: { | ||
| floatPrecision: 3, | ||
| }, | ||
| const nextConfig = { | ||
| webpack: (config, { dev }) => { | ||
| const svgrLoaderConfig = { | ||
| loader: '@svgr/webpack', | ||
| options: { | ||
| svgoConfig: { | ||
| plugins: [ | ||
| { inlineStyles: false }, | ||
| { prefixIds: false }, | ||
| { | ||
| cleanupNumericValues: { | ||
| floatPrecision: 3, | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| } | ||
| }, | ||
| } | ||
| const svgrLoaderConfigWithOutSvgo = { | ||
| ...svgrLoaderConfig, | ||
| options: { | ||
| ...svgrLoaderConfig.options, | ||
| svgo: false, | ||
| }, | ||
| } | ||
| const svgrLoaderConfigWithOutSvgo = { | ||
| ...svgrLoaderConfig, | ||
| options: { | ||
| ...svgrLoaderConfig.options, | ||
| svgo: false, | ||
| }, | ||
| } | ||
| const fileLoaderConfig = { | ||
| loader: 'file-loader', | ||
| options: { | ||
| publicPath: '/_next', | ||
| name: '[path][name]-[hash:8].[ext]', | ||
| }, | ||
| } | ||
| const fileLoaderConfig = { | ||
| loader: 'file-loader', | ||
| options: { | ||
| publicPath: '/_next', | ||
| name: '[path][name]-[hash:8].[ext]', | ||
| }, | ||
| } | ||
| const withImages = (nextConfig = {}) => ({ | ||
| ...nextConfig, | ||
| webpack(config) { | ||
| config.module.rules.push( | ||
| { | ||
| test: /\.(jpe?g|png|gif|webp|ico)$/, | ||
| use: [fileLoaderConfig], | ||
| }, | ||
| { | ||
| test: /\.svg$/, | ||
| oneOf: [ | ||
| const withImages = (nextConfig = {}) => ({ | ||
| ...nextConfig, | ||
| webpack(config) { | ||
| config.module.rules.push( | ||
| { | ||
| resourceQuery: /original/, | ||
| use: [svgrLoaderConfigWithOutSvgo, fileLoaderConfig], | ||
| test: /\.(jpe?g|png|gif|webp|ico)$/, | ||
| use: [fileLoaderConfig], | ||
| }, | ||
| { | ||
| use: [svgrLoaderConfig, fileLoaderConfig], | ||
| test: /\.svg$/, | ||
| oneOf: [ | ||
| { | ||
| resourceQuery: /original/, | ||
| use: [svgrLoaderConfigWithOutSvgo, fileLoaderConfig], | ||
| }, | ||
| { | ||
| use: [svgrLoaderConfig, fileLoaderConfig], | ||
| }, | ||
| ], | ||
| }, | ||
| ], | ||
| ) | ||
| return config | ||
| }, | ||
| ) | ||
| }) | ||
| const withCompression = () => { | ||
| if (!dev) { | ||
| config.plugins.push( | ||
| new CompressionPlugin({ | ||
| test: /\.js$|\.css$|\.html$|\.svg$/, | ||
| threshold: 10240, | ||
| }), | ||
| new CompressionPlugin({ | ||
| test: /\.js$|\.css$|\.html$|\.svg$/, | ||
| algorithm: 'brotliCompress', | ||
| filename: '[path].br[query]', | ||
| compressionOptions: { level: 11 }, | ||
| threshold: 10240, | ||
| }), | ||
| ) | ||
| } | ||
| } | ||
| withImages() | ||
| withCompression() | ||
| return config | ||
| }, | ||
| }) | ||
| } | ||
| module.exports = withPlugins([withFonts], nextConfig) |
@@ -10,3 +10,3 @@ { | ||
| "scripts": { | ||
| "dev": "nodemon --exec node -r esm $NODE_DEBUG_OPTION ./server/index.js", | ||
| "dev": "nodemon --exec node -r esm ./server/index.js", | ||
| "build": "next build", | ||
@@ -13,0 +13,0 @@ "export": "next export && touch ./out/.nojekyll", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
35366
2.34%