question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build error but dev works well

See original GitHub issue

Description

I get Unexpected token error when build.
But in dev mode, it works perfectly without any error.

Steps to reproduce

Clone a sample repo and follow steps.

Expected result

Build complete without error.

Actual result

Get this error:

(function (exports, require, module, __filename, __dirname) { label.radio-toggle-button {
                                                                                        ^

SyntaxError: Unexpected token {

Environment


Libs:
- gridsome version: v0.5.5
- @gridsome/cli version: v0.0.8


Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: v10.15.3  
- Platform: Windows 10 

Others:

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

7reactions
hjvedvikcommented, Apr 3, 2019

@gluons I’m able to build successfully when using webpack-node-externals. So I think we should include it in core in 0.6 with a simple API for whitelisting dependencies.

const nodeExternals = require('webpack-node-externals')

module.exports = {
  chainWebpack(config, { isServer }) {
    if (isServer) {
      config.externals(nodeExternals({
        whitelist: [/\.css$/, /\?vue&type=style/]
      }))
    }
  }
}
2reactions
u12206050commented, May 22, 2019

I am having the same issue using Gridsome 0.6.2. Works fine ingridsome develop, but can’t build.

/…/node_modules/vue-stack-grid/index.js:1
(function (exports, require, module, __filename, __dirname) { import Stack from './src/Stack.vue'
                                                                     ^^^^^

SyntaxError: Unexpected identifier
Read more comments on GitHub >

github_iconTop Results From Across the Web

Production build fails but dev works fine #930 - GitHub
I made some changes, re-wrote unit tests, and confirmed that everything worked well locally. The issue arises on deployment with a similar error...
Read more >
Next.js production fails but dev works - Stack Overflow
The reason why it's doing that in prod and not dev is because nextjs will only check types on a production build (as...
Read more >
Troubleshooting build errors and crashes - Expo Documentation
Go to your build details page (find it on the build dashboard if you don't have it open already) and expand any failed...
Read more >
No errors displayed in the "Error List" (error list doesn't show ...
actually this problem occurs for huge solutions(solution with really more projects), but when i open individual proj and compile error list everything works...
Read more >
Oh dear! Build errors? - LoopDocs - GitHub Pages
This page contains build error help for people updating their Loop app as well ... your error and any messages you've seen while...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found