@kerrishotts: correct, arrow functions work elsewhere in my code.
webpack.config.js
module.exports = {
entry: "./src/main.jsx",
output: {
path: __dirname,
filename: 'main.js',
libraryTarget: "commonjs2"
},
devtool: "none", // prevent webpack from using eval() on my module
externals: {
application: "application",
uxp: "uxp",
assets: "assets",
scenegraph: "scenegraph",
application: "application",
commands: "commands",
clipboard: "clipboard",
cloud: "cloud",
uxp: "uxp",
viewport: "viewport",
interactions: "interactions",
},
resolve: {
extensions: [".js", ".jsx"]
},
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel-loader",
options: {
plugins: [
"transform-react-jsx",
"transform-object-rest-spread",
]
}
},
{
test: /\.png$/,
exclude: /node_modules/,
loader: 'file-loader'
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
}
]
}
};
package.json👇
{
"name": "myReactPlugin",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"start": "npm run watch --production",
"watch": "nodemon -w src -e js,jsx,json,css -w webpack.config.js -x yarn build",
"build": "webpack --mode development"
},
"license": "none",
"private": true,
"devDependencies": {
"css-loader": "^1.0.0",
"file-loader": "^1.1.11",
"nodemon": "^1.18.7",
"style-loader": "^0.22.1",
"webpack": "^4.16.4",
"webpack-cli": "^3.3.12"
},
"dependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"react": "^17.0.1",
"react-dom": "^17.0.1"
}
}