Electron-vue: Blank App after npm run build

Created on 28 Apr 2017  ·  5Comments  ·  Source: SimulatedGREG/electron-vue

Found an issue or bug? Tell me all about!

Blank App after Build (Dev run perfectly)

npm run pack:renderer

show

ERROR in renderer.js from UglifyJs Unexpected token: name (ServerDB) [renderer.js:420,6]

I think there is a similar problem http://stackoverflow.com/questions/43598037/error-in-renderer-js-from-uglifyjs-unexpected-token-punc

Describe the issue / bug.

#

How can I reproduce this problem?

#

If visual, provide a screenshot.

#

Tell me about your development environment.
  • Node version: 6.2.2
  • NPM version: 3.9.5
  • vue-cli version: (if necessary)
  • Operating System: MacOS Sierra

If you are looking to suggest an enhancement or feature, then feel free to remove everything above.

Most helpful comment

This might be an off-shoot answer but IME unexpected token errors usually mean I forgot to tell Babel to transpile a module so UglifyJS gets the unprocessed source with all the new JS features and it doesn't know how to handle; hence the error.

So my bet would be on the babel-loaders configuration. eg...

  {
    test: /\.js$/,
    use: 'babel-loader',
    include: [path.resolve(__dirname, 'app/src'), // make src the root of transpiling, so if your problematic code is under anywhere in src/ Babel will pick it up.
                 //path.resolve(__dirname, 'app/src/renderer') // this is the original line which cages Babel within the renderer/ folder.
              ],
    exclude: /node_modules/
  },

All 5 comments

This might be an off-shoot answer but IME unexpected token errors usually mean I forgot to tell Babel to transpile a module so UglifyJS gets the unprocessed source with all the new JS features and it doesn't know how to handle; hence the error.

So my bet would be on the babel-loaders configuration. eg...

  {
    test: /\.js$/,
    use: 'babel-loader',
    include: [path.resolve(__dirname, 'app/src'), // make src the root of transpiling, so if your problematic code is under anywhere in src/ Babel will pick it up.
                 //path.resolve(__dirname, 'app/src/renderer') // this is the original line which cages Babel within the renderer/ folder.
              ],
    exclude: /node_modules/
  },

Yes that nailed it. This path.resolve(__dirname, 'app/src') was indeed the missing part: <3

I knew I wasn't the only one bitten by this :)

@SimulatedGREG maybe "app/src" should be the default. Because when you add a new module to your project you choose the src/ folder by instinct. It just seems right until NPM shits errors on you.

Thanks for the find @utkukaratas. I'll most likely make this adjustment in the next milestone.

Fix has been pushed the dev branch. Check #171 for more info on final release.

Was this page helpful?
0 / 5 - 0 ratings