parcel: production minify code doesn't work well(npm run build), but development is ok(npm start)

npm scripts pls read package.json below

πŸ› bug report

πŸŽ› Configuration (.babelrc, package.json, cli command)

babelrc

{}

package.json

{
  "name": "xxx",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "start": "cross-env NODE_ENV=development rimraf dist/development & parcel index.html --open -d dist/development/",
    "build": "cross-env NODE_ENV=production rimraf dist/production & parcel build src/index.js --public-url ./dist/production -d dist/production/ --detailed-report"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "jsonp": "^0.2.1",
    "normalize.css": "^8.0.0",
    "query-string": "^6.1.0",
    "scroll-to-element": "^2.0.0",
    "vue": "^2.5.16",
    "vue-hot-reload-api": "^2.3.0",
    "vue-router": "^3.0.1"
  },
  "devDependencies": {
    "@vue/component-compiler-utils": "^2.1.0",
    "babel-core": "^6.26.3",
    "cross-env": "^5.2.0",
    "cssnano": "^4.0.5",
    "node-sass": "^4.9.2",
    "pug": "^2.0.3",
    "vue-template-compiler": "^2.5.16"
  },
  "engines": {
    "node": "8"
  }
}

πŸ€” Expected Behavior

production minify code work normally。(if i minify development code by other minify tool, work well too )

😯 Current Behavior

production minify code doesn’t work well, and have no error in console(page can’t render normal, it’s blank); development code work well, ,

πŸ’ Possible Solution

production minify bug?

🌍 Your Environment

parcel with vue project

Software Version(s)
Parcel 1.9.7
Node 8.9.4
npm/Yarn 5.6.0
Operating System windows 7

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 27 (8 by maintainers)

Most upvoted comments

I also encountered a similar problem, I found a solution: change all <component-name /> to <component-name></component-name>

@DeMoorJasper Done. Issue is at #1910 πŸ˜ƒ

I came here looking for this. I have a Vuejs project that works under dev conditions but not after a build. The build process is successful, I can host the project and run it, but it seems like the app is missing components. The first component is present, looks right and works. It is meant to feed data back to it’s parent, which then passes that as props to other child components. Those components do not show up.

I had a hunch it might be to do with minification, so I changed my npm build script from:

rimraf dist/* && parcel build src/index.html

to

rimraf dist/* && parcel build src/index.html --no-minify

And now the β€œbuild” version works.

My project: https://github.com/freemagee/sugar-cubed/tree/parcel

I am sorry that my project is also not a complete standalone test case as I use an API key, which is not included in the project. I will try to host a working and non working version of the app if that may help.

Without a complete standalone test case to reproduce the problem, this issue may as well be closed.