Code Monkey home page Code Monkey logo

Comments (26)

ai avatar ai commented on June 25, 2024

Show your Size Limit config.

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

You are right, sorry, I will post my entire package.json today, now I am busy. Thanks for contact.

from size-limit.

ai avatar ai commented on June 25, 2024

I don't know the whole story, but seems like you need pack the bundle with your own bundler and then set webpack: false to Size Limit to analyze bundle size without Size Limit’s webpack.

Or you can change the config in Size Limit’s webpack by config option.

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Here is the proccess:

yarn build to generate the folder dist, for production use, this is the contents:

dist
-> static
* css
* img
* js
a) app.2bfb4a074f9c26036815.js 224k
b) app.2bfb4a074f9c26036815.js.map 1,2M
c) manifest.02852648766036734d1d.js 1,5k
d) manifest.02852648766036734d1d.js.map 14k
e) vendor.5cdde3773ae3cbb861de.js 667k
f) vendor.5cdde3773ae3cbb861de.js.map 4,1M
* webfonts
-> .htaccess
-> index.html
-> service-worker.js

This is my package.json:

{
  "name": "my-little-ponney",
  "version": "1.0.0",
  "description": "Entire Personal Project",
  "author": "me",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=desenvolvimento node build/dev-server.js",
    "start": "node build/dev-server.js",
    "build": "cross-env NODE_ENV=production node build/build.js",
    "build-dev": "cross-env NODE_ENV=desenvolvimento node build/build.js",
    "build-hom": "cross-env NODE_ENV=homologacao node build/build.js",
    "unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
    "e2e": "node test/e2e/runner.js",
    "test": "npm run unit && npm run e2e",
    "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
    "size": "yarn build && size-limit"
  },
  "dependencies": {
    "@bootstrapstudio/bootstrap-better-nav": "^1.3.2",
    "await-to-js": "^2.0.1",
    "axios": "^0.17.1",
    "bootstrap": "^4.0.0",
    "bootstrap-hover-dropdown": "^2.2.1",
    "jquery": "^3.3.1",
    "moment": "^2.20.1",
    "popper.js": "^1.12.9",
    "vue": "^2.5.2",
    "vue-axios": "^2.0.2",
    "vue-mq": "^0.2.1",
    "vue-router": "^3.0.1",
    "vue-toasted": "^1.1.24",
    "vuejs-datepicker": "^0.9.26",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.5",
    "babel-core": "^6.26.0",
    "babel-eslint": "^8.0.1",
    "babel-loader": "^7.1.2",
    "babel-plugin-istanbul": "^4.1.5",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.6.0",
    "babel-preset-stage-2": "^6.24.1",
    "babel-register": "^6.26.0",
    "chai": "^4.1.2",
    "chalk": "^2.1.0",
    "chromedriver": "^2.33.1",
    "connect-history-api-fallback": "^1.4.0",
    "copy-webpack-plugin": "^4.1.1",
    "cross-env": "^5.0.5",
    "cross-spawn": "^5.1.0",
    "css-loader": "^0.28.7",
    "cssnano": "^3.10.0",
    "eslint": "^4.9.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-html": "^3.2.2",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-node": "^5.2.0",
    "eslint-plugin-promise": "^3.6.0",
    "eslint-plugin-standard": "^3.0.1",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.16.2",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.5",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "html-webpack-plugin": "^2.30.1",
    "http-proxy-middleware": "^0.17.4",
    "inject-loader": "^3.0.1",
    "jest": "^22.4.2",
    "karma": "^1.7.1",
    "karma-coverage": "^1.1.1",
    "karma-mocha": "^1.3.0",
    "karma-phantomjs-launcher": "^1.0.4",
    "karma-phantomjs-shim": "^1.5.0",
    "karma-sinon-chai": "^1.3.2",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-spec-reporter": "0.0.31",
    "karma-webpack": "^2.0.5",
    "mocha": "^4.0.1",
    "nightwatch": "^0.9.16",
    "node-sass": "^4.7.2",
    "opn": "^5.1.0",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.3.0",
    "phantomjs-prebuilt": "^2.1.15",
    "rimraf": "^2.6.2",
    "sass-loader": "^6.0.6",
    "selenium-server": "^3.6.0",
    "semver": "^5.4.1",
    "shelljs": "^0.7.8",
    "sinon": "^4.0.1",
    "sinon-chai": "^2.14.0",
    "size-limit": "^0.18.0",
    "ssh-webpack-plugin": "^0.1.7",
    "sw-precache-webpack-plugin": "^0.11.4",
    "uglify-es": "^3.1.3",
    "url-loader": "^0.6.2",
    "vue-loader": "^13.3.0",
    "vue-style-loader": "^3.0.3",
    "vue-template-compiler": "^2.5.2",
    "webpack": "^3.7.1",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-middleware": "^1.12.0",
    "webpack-hot-middleware": "^2.19.1",
    "webpack-merge": "^4.1.0"
  },
  "engines": {
    "node": ">= 4.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ],
  "size-limit": {
    "path": "./src/main.js",
    "webpack": false
  }
}

from size-limit.

ai avatar ai commented on June 25, 2024

OK. You need to size-limit.path to your build bundle, not source files

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

You mean the build.js or the contents inside dist folder?

from size-limit.

ai avatar ai commented on June 25, 2024

Contents inside dist folder

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

I changed to this:

"size-limit": [
    {
      "path": "./dist",
      "webpack": false
    }
  ]

I got this message:

Package size: 3.11 MB
With all dependencies, minified and gzipped

But I can not see the generated files, the size still the same

$ du -sh dist/
9,7M	dist/

from size-limit.

ai avatar ai commented on June 25, 2024

Show your dist/ content. (Maybe you need to add something to path.

from size-limit.

ai avatar ai commented on June 25, 2024

BTw, by writing only path: "dist/" you are asking Size Limit to check only dist/index.js. If you want to check every files inside dist/, set path: "dist/*"

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Ok, I will try with dist/*

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Well, remains the same size.

Size-limit output:

Package size: 2.69 KB
With all dependencies, minified and gzipped

My dist folder:

$ du -sh dist/
9,7M	dist/

from size-limit.

ai avatar ai commented on June 25, 2024

Show your dist/ content.

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Here:

dist
    -> static (folder)
                * css (folder)
                * img (I have some images here) (folder)
                * js (folder)
                     a) app.2bfb4a074f9c26036815.js 224k
                     b) app.2bfb4a074f9c26036815.js.map 1,2M
                     c) manifest.02852648766036734d1d.js 1,5k
                     d) manifest.02852648766036734d1d.js.map 14k
                     e) vendor.5cdde3773ae3cbb861de.js 667k
                     f) vendor.5cdde3773ae3cbb861de.js.map 4,1M
                * webfonts (some fonts here) (folder)
  -> .htaccess (file)
  -> index.html (file)
  -> service-worker.js (file)

from size-limit.

ai avatar ai commented on June 25, 2024
      "path": "dist/**/*.{js,css,svg,png,jpg}"

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

The same result, the dist folder is 9,7M.

Size-limit output:
Package size: 1.13 MB
With all dependencies, minified and gzipped

This size-limit works only to js files? Can I test with only one file without webpack?

from size-limit.

ai avatar ai commented on June 25, 2024

Check the size of .map files. hey will not be loaded to clients, so you don’t need to check their size.

Size Limit with webpack: false can work with any files :).

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Well, the map files are bigger, but the size not changed when I do size-limit with only one file too. Maybe my project configuration not works with size-limit.

from size-limit.

ai avatar ai commented on June 25, 2024

What is a size or your *.js, *.css and images? (check it manually)

Maybe my project configuration not works with size-limit.

It works, you just need to set correct path to dist according the files important for you.

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

I tried point to only one file:

"size-limit": [
    {
      "path": "dist/static/js/vendor.5cdde3773ae3cbb861de.js",
      "webpack": false
    }
  ]

And the size not changed.

This file has the original size of 677k, using size-limit the size not changed.

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Is important to see that this vendor is minified and uglyfied, maybe this is the problem?

from size-limit.

ai avatar ai commented on June 25, 2024

Hm, maybe we have a issue here :-/

I will check it this weekend.

As temporary solution you can write a list of files in array:

"size-limit": [
    {
      "path": [
        "dist/static/js/vendor.*.js"
        "dist/static/js/app.*.js"
      ]
      "webpack": false
    }
  ]

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Ok @ai Thanks for attention, I will waiting for your time.

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Other important information is that, when I tried to use size-limit to .map files, an error is raised.

from size-limit.

rof20004 avatar rof20004 commented on June 25, 2024

Good day, see you later :)

from size-limit.

ai avatar ai commented on June 25, 2024

@rof20004 also, Size Limit gzip the files (since your client will receive files gzipped).

You can add gzip: false to check files without gzipped. But I recommend to keep it.

from size-limit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.