Skip to content

Commit

Permalink
Pull browserslist from package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
encounter committed Oct 24, 2024
1 parent 89a12f6 commit e4da005
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions rspack.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as rspack from '@rspack/core';
import * as fs from 'node:fs';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { GitRevisionPlugin } from 'git-revision-webpack-plugin';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';

// Target browsers, see: https://github.com/browserslist/browserslist
const targets = ["chrome >= 87", "edge >= 88", "firefox >= 78", "safari >= 14"];
const targets = JSON.parse(fs.readFileSync(__dirname + '/package.json', 'utf8')).browserslist;
const gitRevision = new GitRevisionPlugin();

const config: rspack.Configuration = {
Expand All @@ -17,7 +17,6 @@ const config: rspack.Configuration = {
path: __dirname + '/dist',
filename: '[name]-[contenthash].js',
},
target: 'web',
// Disable asset size limit warnings
performance: false,
resolve: {
Expand Down Expand Up @@ -99,9 +98,6 @@ const config: rspack.Configuration = {
optimization: {
minimizer: [
new rspack.SwcJsMinimizerRspackPlugin(),
new rspack.LightningCssMinimizerRspackPlugin({
minimizerOptions: { targets },
})
]
},
};
Expand Down

0 comments on commit e4da005

Please sign in to comment.