• I’m using @wordpress/scripts in my theme to compile and compress javascript and scss. And everything works fine if i’m using the defualt things. But I want to add 2 custom javascript files. But when I do that it throws this error:
    [webpack-cli] Unknown command or entry 'index=./src/index.js'

    And this is how my package.json file looks like:

    {
     "name": "base-theme",
     "version": "1.0.0",
     "description": "Main File for WP theme",
     "repository": {},
     "license": "UNLICENSED",
     "dependencies": {
       "uuid": "^8.3.0"
     },
     "devDependencies": {
        "@types/react": "^16.9.47",
        "@wordpress/scripts": "^18.0.0",
        "autoprefixer": "^9.7.3",
        "browser-sync": "^2.27.5",
        "browser-sync-webpack-plugin": "^2.3.0",
        "copy-webpack-plugin": "^6.0.3",
        "css-loader": "^2.1.1",
        "extract-loader": "^3.1.0",
        "file-loader": "^3.0.1",
        "livereload": "^0.9.3",
        "node-sass": "^6.0.1",
        "postcss": "^8.1.0",
        "postcss-loader": "^3.0.0",
        "postcss-preset-env": "^6.6.0",
        "prettier": "^1.13.0",
        "sass-loader": "^8.0.2",
        "style-loader": "^1.1.2",
        "typescript": "^2.8.0",
        "webpack": "^5.0.0"
      },
      "stylelint": {
        "extends": "stylelint-config-recommended"
      },
      "scripts": {
        "start": "wp-scripts start",
        "build": "wp-scripts build src/index.js src/index-admin.js"
      }
    }

    so the error is throwed when i’m running “npm run build”

    And I have tried to google around allot, and have tried to add an output folder also. But nothing helps.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘@wordpress/scripts adding custom js files throws error’ is closed to new replies.