Skip to content
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

Respect SCRIPT_DEBUG in released plugin versions #1026

Closed
nylen opened this issue Jun 5, 2017 · 2 comments
Closed

Respect SCRIPT_DEBUG in released plugin versions #1026

nylen opened this issue Jun 5, 2017 · 2 comments
Assignees
Labels
[Type] Build Tooling Issues or PRs related to build tooling

Comments

@nylen
Copy link
Member

nylen commented Jun 5, 2017

When we release plugin versions, we should allow people to debug our JavaScript using the SCRIPT_DEBUG constant. This constant is defined and used by core, but it's nice to support it in plugins also.

This is currently working for vendor JavaScript code like React and Moment.js, since we load the minified or non-minified versions of these files based on the value of this constant. However, it's not working for our own JavaScript code because we always build to and load from the same set of files, regardless of whether they are minified or not.

This means that currently:

  • During plugin development, the version of JS and CSS that will be loaded is the last one built, whether minified or not.
  • Release versions of the plugin will always use the minified files, because they were the last version built.

The behavior during plugin development is probably what we want; however, we should bundle both the development (unminified) and production (minified) versions of our JS and CSS with the plugin, like we do for vendor files.

In order to achieve this we'll need to add a npm run build-dev command that writes to a separate set of files, and modify the plugin logic for release mode only to load either of these sets of files based on SCRIPT_DEBUG.

This will also give us a way to allow users to enable the Save button themselves during early releases: just enable SCRIPT_DEBUG on their WP install. See #748.

@nylen nylen added the [Type] Build Tooling Issues or PRs related to build tooling label Jun 5, 2017
@nylen nylen added this to the Beta 0.8.0 milestone Aug 7, 2017
@nylen nylen self-assigned this Aug 7, 2017
@mtias mtias removed this from the Beta 0.8.0 milestone Aug 11, 2017
@jeffpaul
Copy link
Member

This ticket was mentioned in Slack in #core-editor by jeffpaul. View the logs.

@jeffpaul
Copy link
Member

Closing this per today's Gutenberg bug scrub given lack of request to support this and not wanting to have to ship unminified versions of JavaScript.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

No branches or pull requests

3 participants