WeareJH / config-gen

Generate RequireJS Optimizer configuration for a Magento 2 website based on real-world usage.
84 stars 9 forks source link

build.json file is empty #24

Open natewoodbridge opened 6 years ago

natewoodbridge commented 6 years ago

Hey, Using the default config in the README, I get an empty build.json file.

I might being a bit too keen, or if I have not followed the instructions correctly - I know you are going to add some demo code.

Thanks!

I have a file public_html/config-gen.yml:

presets:
  - name: m2
    options:
      bundle_config: file:test/fixtures/bundle-config.yml

And public_html/test/fixtures/bundle-config.yml:

bundles:
  - name: "bundles/main"
    urls:
      - "/"
    children:
      - name: "bundles/product"
        urls:
          - "/test-bracelet/"
        children: []

But when I try and visit (after visiting https://127.0.0.1:8080/ once) https://127.0.0.1:8080/__bs/build.json gives me this:

{
  "generateSourceMaps": true,
  "inline_text": true,
  "optimize": "none",
  "deps": [],
  "map": {},
  "config": {},
  "shim": {},
  "paths": {},
  "modules": [
    {
      "name": "requirejs/require",
      "include": [],
      "exclude": [],
      "create": false
    },
    {
      "name": "bundles/main",
      "include": [],
      "exclude": [
        "requirejs/require"
      ],
      "create": true
    },
    {
      "name": "bundles/product",
      "include": [],
      "exclude": [
        "requirejs/require",
        "bundles/main"
      ],
      "create": true
    }
  ]
}
shakyShane commented 6 years ago

@natewoodbridge it could be your browser cache preventing the requests (I have solutions for this in the works)

I normally visit the site with dev-tools open and 'disable network cache' checked.

shakyShane commented 6 years ago

ohh, actually, if someone could dig up the correct flag for launching chrome with network cache disabled by default, that would be amazing

tdgroot commented 6 years ago

My build.json seems to be pretty empty too.

@shakyShane there's a few options for Chrome/Chromium to change cache settings:

I don't know if --disk-cache-dir would do the trick by setting it to /dev/null.

Otherwise, you could set the size to 1 for --disk-cache-size or --media-cache-size.

prasmussen commented 6 years ago

Check that require.js is loaded from a path that matches this pattern: /static/{version}/frontend/{vendor}/{theme}/{locale}/requirejs/require.js

On my test server it was loaded from /pub/static/... which caused an empty build.json.

shakyShane commented 6 years ago

Hmm, I think we need to make that path configurable - needs moving into the options