SyntaxError: Invalid character '\ud835'
When running a web application (built with Typescript + Webpack) inside Safari I am facing the error above (not faced in other browsers).
From searching all node_modules, ethers.js contains:
const EtherSymbol = "\u039e"; // "\uD835\uDF63";\n//#
The solution in this specific scenario was to add the terser plugin within webpack 5.
https://webpack.js.org/plugins/terser-webpack-plugin/
const isModern = false;
const customTerserOptions = { ... } // from this url - https://github.com/terser/terser/issues/729
module.exports = {
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: customTerserOptions
In my case this code did the trick
const TerserPlugin = require("terser-webpack-plugin");
const webpackConfig = {
...
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
terserOptions: {
safari10: true
}
})],
}
...
}
module.exports = webpackConfig;