Skip to main content
Participant
May 21, 2023
Question

UXP React Starter Webpack and Version Issues

  • May 21, 2023
  • 0 replies
  • 550 views

Hi, I am using com.adobe.uxp.starter.react to create a plugin for Photoshop. However, when I add new npm packages and run,

npm run watch

, I get the error cannot find module "acorn-base" and acorn is in package.json file in resolutions object.

 

{
  "name": "com.adobe.uxp.starter.react",
  "version": "1.0.0",
  "scripts": {
    "preinstall": "npx npm-force-resolutions",
    "watch": "nodemon -w src -e js,jsx,json,css,html -w webpack.config.js -x npm run build",
    "build": "webpack --mode development",
    "uxp:load": "cd dist && uxp plugin load",
    "uxp:reload": "cd dist && uxp plugin reload",
    "uxp:watch": "cd dist && nodemon --exec \"uxp plugin reload\" -e js,css,html",
    "uxp:debug": "cd dist && uxp plugin debug"
  },
  "author": "Adobe Inc",
  "license": "Apache-2.0",
  "devDependencies": {
    "@babel/core": "^7.8.7",
    "@babel/plugin-proposal-object-rest-spread": "^7.8.3",
    "@babel/plugin-syntax-class-properties": "^7.10.4",
    "@babel/plugin-transform-react-jsx": "^7.8.3",
    "babel-loader": "^8.0.6",
    "clean-webpack-plugin": "^2.0.2",
    "copy-webpack-plugin": "^5.0.3",
    "css-loader": "^2.1.1",
    "file-loader": "^5.1.0",
    "style-loader": "^1.1.3",
    "webpack": "^4.32.2",
    "webpack-cli": "^3.3.2"
  },
  "dependencies": {
    "cross-env": "^7.0.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6"
  },
  "resolutions": {
    "acorn": "npm:acorn-with-stage3"
  }
}

  I don't have much knowledge about webpack or acorn parser. How and why they work. 
Also, acorn does not work with latest node version so I had to downgrade to node v16. 

In conclusion,

I cannot add new npm packages to import and create stuff with open source libraries with current version of this starter repo. I need to somehow get rid of this acorn, update my webpack and node versions, and use open source libraries but I don't know how, should i replace it with some other library?  Use a newer webpack version and different parser? Is there any newer code to work with latest versions of react and webpack? Is there any other way I can just setup a UXP and react environment from scracth?

This topic has been closed for replies.