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 for production not minifying app.js

See original GitHub issue

Version

3.0.1

Node and OS info

Node 10.6.0 / npm 6.4.0 / Windows 10

Steps to reproduce

  • Created a new project with vue create and chose my settings
  • Added some SCSS, imported, and ran npm run build

What is expected?

Split CSS from JS, and minify everything.

What is actually happening?

CSS is still inside JS and not only the JS file app.js is not being minified, but all evals from development are still in there.


I’ve restarted my computer, deleted node_modules and reinstalled everything. Also I notice the “building for production” text is displayed, so it should be doing the right thing, yet the output app.js file is 933.61kb in size, and I only have a simple Vue Vuex setup and some CSS, nothing more.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

8reactions
yyx990803commented, Aug 17, 2018

You probably have a default NODE_ENV set in your shell. Delete it, or explicitly set NODE_ENV when running build.

7reactions
matheusgriegercommented, Oct 2, 2018

@rowild as it turns out, @yyx990803 was right. However, on Windows, I have no idea where that would be set. That said, I added cross-env and changed my build script to:

cross-env NODE_ENV=production vue-cli-service build

It solved my problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

npm run build is not minifying the reactJs project
Hover over the extension if it says you are using production build then your files are minified. As you can see the image...
Read more >
Production | webpack
In this guide, we'll dive into some of the best practices and utilities for building a production site or application.
Read more >
Concatenation and Minification | Laravel Mix Documentation
So minifying app.js will generate app.min.js . Once again, the minification will only take place during a production build. ( export NODE_ENV=production )....
Read more >
Production - Parcel
By default, minification is enabled when using the parcel build command. You can use the --no-optimize CLI flag to disable minification and other...
Read more >
Build Targets - Vue CLI
If no entry is specified, src/App.vue will be used. A lib build outputs: ... dist/myLib.umd.min.js : Minified version of the UMD build.
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