Skip to content

Read data from an "entrypoints" key instead of the root of the entrypoints.json file #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2018

Conversation

Lyrkan
Copy link
Contributor

@Lyrkan Lyrkan commented Oct 30, 2018

This PR changes how the entrypoints.json lookup works in order to support symfony/webpack-encore#424.

Currently the entrypoints are directly listed at the root of the entrypoints.json file:

{
  "my_entry": {
    "js": [
        "build/file1.js",
        "build/file2.js"
    ],
    "css": [
      "build/styles.css",
      "build/styles2.css"
    ]
  },
  "other_entry": {
    "js": [
        "build/file1.js",
        "build/file3.js"
    ]
  }
}

This works fine but will be a bit annoying later on if we want to add additional data such as files hashes that could be used to automatically handle the integrity attribute of the generated <script> tags.

A solution to that issue would be to move all the current data under an entrypoints key and add new keys when needed (for instance hashes):

{
  "entrypoints": {
    "my_entry": {
      "js": [
          "build/file1.js",
          "build/file2.js"
      ],
      "css": [
        "build/styles.css",
        "build/styles2.css"
      ]
    },
    "other_entry": {
      "js": [
          "build/file1.js",
          "build/file3.js"
      ]
    }
  }
}

@weaverryan
Copy link
Member

Thanks @Lyrkan!

@weaverryan weaverryan merged commit 97bcbae into symfony:master Nov 2, 2018
weaverryan added a commit that referenced this pull request Nov 2, 2018
…the entrypoints.json file (Lyrkan)

This PR was merged into the master branch.

Discussion
----------

Read data from an "entrypoints" key instead of the root of the entrypoints.json file

This PR changes how the `entrypoints.json` lookup works in order to support symfony/webpack-encore#424.

Currently the entrypoints are directly listed at the root of the `entrypoints.json` file:

```json
{
  "my_entry": {
    "js": [
        "build/file1.js",
        "build/file2.js"
    ],
    "css": [
      "build/styles.css",
      "build/styles2.css"
    ]
  },
  "other_entry": {
    "js": [
        "build/file1.js",
        "build/file3.js"
    ]
  }
}
```

This works fine but will be a bit annoying later on if we want to add additional data such as [files hashes](symfony/webpack-encore#418) that could be used to automatically handle the `integrity` attribute of the generated `<script>` tags.

A solution to that issue would be to move all the current data under an `entrypoints` key and add new keys when needed (for instance `hashes`):

```json
{
  "entrypoints": {
    "my_entry": {
      "js": [
          "build/file1.js",
          "build/file2.js"
      ],
      "css": [
        "build/styles.css",
        "build/styles2.css"
      ]
    },
    "other_entry": {
      "js": [
          "build/file1.js",
          "build/file3.js"
      ]
    }
  }
}
```

Commits
-------

97bcbae Put current data under an "entrypoints" key in the entrypoints.json file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants