mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-17 11:09:41 +00:00
Only use Babel to process .js files.
This commit is contained in:
4
.babelrc
4
.babelrc
@@ -4,7 +4,7 @@
|
|||||||
"env",
|
"env",
|
||||||
{
|
{
|
||||||
"loose": true,
|
"loose": true,
|
||||||
"uglify": true,
|
"uglify": false,
|
||||||
"modules": false,
|
"modules": false,
|
||||||
"targets": {
|
"targets": {
|
||||||
"browsers": "last 2 versions"
|
"browsers": "last 2 versions"
|
||||||
@@ -17,10 +17,8 @@
|
|||||||
]
|
]
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"syntax-dynamic-import",
|
|
||||||
"transform-decorators-legacy",
|
"transform-decorators-legacy",
|
||||||
"transform-class-properties",
|
"transform-class-properties",
|
||||||
"transform-object-rest-spread",
|
|
||||||
"transform-react-constant-elements",
|
"transform-react-constant-elements",
|
||||||
"transform-react-remove-prop-types",
|
"transform-react-remove-prop-types",
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ const fs = require('fs');
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
||||||
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||||
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
@@ -49,23 +50,6 @@ module.exports = function(_, env) {
|
|||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
|
||||||
test: /\.tsx?$/,
|
|
||||||
exclude: nodeModules,
|
|
||||||
// Ensure typescript is compiled prior to Babel running:
|
|
||||||
enforce: 'pre',
|
|
||||||
use: [
|
|
||||||
// pluck the sourcemap back out so Babel creates a composed one:
|
|
||||||
'source-map-loader',
|
|
||||||
'ts-loader'
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(ts|js)x?$/,
|
|
||||||
loader: 'babel-loader',
|
|
||||||
// Don't respect any Babel RC files found on the filesystem:
|
|
||||||
options: Object.assign(readJson('.babelrc'), { babelrc: false })
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
test: /\.(scss|sass)$/,
|
test: /\.(scss|sass)$/,
|
||||||
loader: 'sass-loader',
|
loader: 'sass-loader',
|
||||||
@@ -113,6 +97,17 @@ module.exports = function(_, env) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.tsx?$/,
|
||||||
|
exclude: nodeModules,
|
||||||
|
loader: 'ts-loader'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.jsx?$/,
|
||||||
|
loader: 'babel-loader',
|
||||||
|
// Don't respect any Babel RC files found on the filesystem:
|
||||||
|
options: Object.assign(readJson('.babelrc'), { babelrc: false })
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -225,6 +220,28 @@ module.exports = function(_, env) {
|
|||||||
})
|
})
|
||||||
].filter(Boolean), // Filter out any falsey plugin array entries.
|
].filter(Boolean), // Filter out any falsey plugin array entries.
|
||||||
|
|
||||||
|
optimization: {
|
||||||
|
minimizer: [
|
||||||
|
new UglifyJsPlugin({
|
||||||
|
sourceMap: isProd,
|
||||||
|
extractComments: {
|
||||||
|
file: 'build/licenses.txt'
|
||||||
|
},
|
||||||
|
uglifyOptions: {
|
||||||
|
compress: {
|
||||||
|
inline: 1
|
||||||
|
},
|
||||||
|
mangle: {
|
||||||
|
safari10: true
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
safari10: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
// Turn off various NodeJS environment polyfills Webpack adds to bundles.
|
// Turn off various NodeJS environment polyfills Webpack adds to bundles.
|
||||||
// They're supposed to be added only when used, but the heuristic is loose
|
// They're supposed to be added only when used, but the heuristic is loose
|
||||||
// (eg: existence of a variable called setImmedaite in any scope)
|
// (eg: existence of a variable called setImmedaite in any scope)
|
||||||
|
|||||||
Reference in New Issue
Block a user