'SyntaxError: Invalid character '\ud835'
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//#
Solution 1:[1]
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
Solution 2:[2]
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;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nick Taras |
| Solution 2 | Number16BusShelter |
