# Whats the purpose of assetsPluginProcessOutput?

**URL:** https://discourse.roots.io/t/whats-the-purpose-of-assetspluginprocessoutput/6851
**Category:** sage
**Created:** 2016-06-01T08:21:56Z
**Posts:** 4

## Post 1 by @kregenrek — 2016-06-01T08:21:56Z

Hi,

everytime I try to create a production of my sage-9 theme it fails:

`webpack -d --progress --release`

**OUTPUT**

```
TypeError: Path must be a string. Received { js: 'scripts/customizer_0fefe09edc473dfa8cef.js' }
    at assertPath (path.js:7:11)
    at Object.extname (path.js:1429:5)
    at Object.assetsPluginProcessOutput [as processOutput] (/Users/Kevin/webwork/burnaut/wpahri.dev/web/app/themes/mj/webpack.config.js:52:16)
    at ReadFileContext.callback (/Users/Kevin/webwork/burnaut/wpahri.dev/web/app/themes/mj/node_modules/assets-webpack-plugin/lib/output/createOutputWriter.js:43:30)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:359:13)
```

The code fails in the assetsPluginProcessOutput function:

**webpack.config.js**

` if (path.extname(assets[name]) === '') { // << error`

**debug assets object: console.info(assets)**

```
main: 
   { js: 'scripts/main_0fefe09edc473dfa8cef.js',
     css: 'styles/main_0fefe09edc473dfa8cef.css' } }
{ js: 'scripts/customizer_0fefe09edc473dfa8cef.js' }
```

I removed the processOutput option for the assets-webpack-plugin  
and it works. So whats the downside of removing this?

```
webpackConfig.plugins.push(new AssetsPlugin({
    path: path.join(__dirname, config.output.path),
    filename: 'assets.json',
    fullPath: false
    //processOutput: assetsPluginProcessOutput
  }));
```

EDIT:

Oh an here is my config.json

```
{
  "context": "assets",
  "entry": {
    "main": [
      "./scripts/main.js",
      "./styles/main.scss"
    ],
    "customizer": [
      "./scripts/customizer.js"
    ]
  },
  "output": {
    "path": "dist",
    "publicPath": "/app/themes/mj/dist/"
  },
  "devUrl": "http://wpahri.dev",
  "devPort": 3000
}
```

EDIT2:

If I add the js property it works:

` if (path.extname(assets[name].js) === '') { // << error`

EDIT3:

Shouldn’t the production output be just dist/scripts/main.js without hash?  
You will get an 404 in the production build because you load main.js and main.css.

Regards Kevin

---

## Post 2 by @Nicolo_Sacchi — 2016-06-01T22:48:47Z

The purpose of production is to have hashed version of your bundles in order to leverage cache bursting.  
Production also runs an additional level of optimization on your assets, removing comments, minifying and other things.

Currently the function is working fine on my environment though and I cannot replicate your error.

---

## Post 3 by @kregenrek — 2016-06-02T17:20:45Z

Hi,

EDIT: It’s working now. Here is the fix: [https://github.com/roots/sage/issues/1659#issuecomment-223032889](https://github.com/roots/sage/issues/1659#issuecomment-223032889)

Regards

---

## Post 4 by @Nicolo_Sacchi — 2016-06-02T22:59:06Z

Awesome! Thank you for pointing it out!
