400 error with custom Webpack config

I have two projects that run as static sites on Cloudflare Workers. Technically they’re just JS files that get pulled by our client implementations.

I have them building and deploying using Wrangler, but when I switch to our custom Webpack config, it builds but fails during the deploy to Cloudflare step.

The error message I get is:
Error: Something went wrong! Status: 400 Bad Request, Details {
“result”: null,
“success”: false,
“errors”: [
{
“code”: 10021,
“message”: “Uncaught SyntaxError: Unexpected identifier\n at line 5\n”
}
],
“messages”:
}

It’s unclear to me where that syntax error is, especially since we run eslint on the code as part of the Webpack, and when I build it locally everything builds and runs fine.

Does anyone know how I should go about debugging this?

Can you post sections of your wangler.toml and webpack.config?
:warning: Omit all sensitive data.

Here’s the Wrangler file:
image

And here is the whole webpack config!

const path = require(“path”);
const TerserPlugin = require(“terser-webpack-plugin”);
const CompressionPlugin = require(“compression-webpack-plugin”);
const MiniCssExtractPlugin = require(“mini-css-extract-plugin”);

const javascriptConfig = {
mode: “production”,
entry: “./src/index.js”,
module: {
rules: [
{
test: /.(js|jsx)/, exclude: /(node_modules|bower_components)/, use: [ { loader: "babel-loader" }, "eslint-loader" ] }, { test: /\.scss/,
use: [
MiniCssExtractPlugin.loader,
“css-loader”,
{
loader: “sass-loader”,
options: {
implementation: require(“sass”), // eslint-disable-line global-require
sassOptions: {
includePaths: [path.resolve(__dirname, “src/styles/core”)]
}
}
}
]
}
]
},
resolve: {
alias: {
Views: path.resolve(__dirname, “src/views”),
Directors: path.resolve(__dirname, “src/directors”),
Styles: path.resolve(__dirname, “src/styles”)
}
},
devtool: “source-map”,
optimization: {
minimize: true,
usedExports: true,
minimizer: [new TerserPlugin({ sourceMap: true })]
},
plugins: [
new CompressionPlugin(),
new MiniCssExtractPlugin()
],
output: {
filename: “consentry-widget.min.js”,
path: path.resolve(__dirname, “dist”)
}
};

/*
const stylesConfig = {
name: “styles”,
entry: ".
};

module.exports = [javascriptConfig, stylesConfig];
*/

module.exports = javascriptConfig;