Title: @wordpress/scripts adding custom js files throws error
Last modified: August 25, 2021

---

# @wordpress/scripts adding custom js files throws error

 *  [zarex](https://wordpress.org/support/users/zarex/)
 * (@zarex)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/wordpress-scripts-adding-custom-js-files-throws-error/)
 * I’m using [@wordpress](https://wordpress.org/support/users/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)

 *  [Glen Davies](https://wordpress.org/support/users/glendaviesnz/)
 * (@glendaviesnz)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/wordpress-scripts-adding-custom-js-files-throws-error/#post-14805931)
 * Does it run ok if you change it to just: `"build": "wp-scripts build"`?
 *  Thread Starter [zarex](https://wordpress.org/support/users/zarex/)
 * (@zarex)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/wordpress-scripts-adding-custom-js-files-throws-error/#post-14806431)
 * Yeh it runs without a problem when I just run it with just `"build": "wp-scripts
   build"`
 *  [Glen Davies](https://wordpress.org/support/users/glendaviesnz/)
 * (@glendaviesnz)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/wordpress-scripts-adding-custom-js-files-throws-error/#post-14809546)
 * It turns out this is a known issue after a recent upgrade to Webpack 5. There
   is an open Pull Request to fix it at [https://github.com/WordPress/gutenberg/pull/34264](https://github.com/WordPress/gutenberg/pull/34264)
 * While you wait for this fix to be merged and released, if you install `@wordpress/
   scripts@17.1.0` it should work as expected.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘@wordpress/scripts adding custom js files throws error’ is closed to 
new replies.

## Tags

 * [custom theme](https://wordpress.org/support/topic-tag/custom-theme/)
 * [webpack](https://wordpress.org/support/topic-tag/webpack/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 3 replies
 * 2 participants
 * Last reply from: [Glen Davies](https://wordpress.org/support/users/glendaviesnz/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/wordpress-scripts-adding-custom-js-files-throws-error/#post-14809546)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
