Skip to content

Changes manifest file extension from json to js. #8494

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

Closed
wants to merge 1 commit into from
Closed

Changes manifest file extension from json to js. #8494

wants to merge 1 commit into from

Conversation

Cifixie
Copy link
Contributor

@Cifixie Cifixie commented Oct 9, 2017

JSON as itself isn't valid Javascript causing an error when trying to parse as javascript: manifest.json:2 Uncaught SyntaxError: Unexpected token : and it's only meant for Symfony asset versioning.

The bundler also creates manifest.js -file which creates window.webpackJsonp used in bundles. Without it, you might get an error: app.315f91d41365513eb8ea.js:1 Uncaught ReferenceError: webpackJsonp is not defined

The json -file is only meant for Symfony asset versioning when the js -file creates `window.webpackJsonp` used in bundles.
@xabbuh
Copy link
Member

xabbuh commented Oct 9, 2017

This was only recently changed in #8438. Can someone confirm which extension is the right one?

ping @weaverryan

@xabbuh xabbuh added this to the 3.3 milestone Oct 9, 2017
@javiereguiluz
Copy link
Member

I've just rebuild all assets for symfony.com app:

encore-assets

There are two manifest files:

  • manifest.json (which is always called like that) is just a JSON array of files.
  • manifest.js (which can be versioned) is the file you must include in your template.

In symfony.com templates we have this:

<script src="{{ asset('build/manifest.js') }}"></script>

The JSON file is only used in the framework.assets config:

framework:
    assets:
        json_manifest_path: '%kernel.project_dir%/web/build/manifest.json'

Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'm sorry for the confusion and for having approved #8438, which introduced this bug.

@xabbuh
Copy link
Member

xabbuh commented Oct 13, 2017

Thank you @Cifixie.

xabbuh added a commit that referenced this pull request Oct 13, 2017
This PR was submitted for the master branch but it was merged into the 3.3 branch instead (closes #8494).

Discussion
----------

Changes manifest file extension from json to js.

JSON as itself isn't valid Javascript causing an error when trying to parse as javascript: `manifest.json:2 Uncaught SyntaxError: Unexpected token :`  and it's only meant for Symfony asset versioning.

The bundler also creates `manifest.js` -file which creates `window.webpackJsonp` used in bundles. Without it, you might get an error: `app.315f91d41365513eb8ea.js:1 Uncaught ReferenceError: webpackJsonp is not defined`

Commits
-------

5d13c37 Changes manifest file extension from json to js.
@xabbuh xabbuh closed this Oct 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants