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
asset_host + jQuery producing invalid javascript? #1873
Comments
Video walkthrough illustrating steps to reproduce the issue: https://youtu.be/xRlU38q-QxU Updated example repo with full instructions in README: https://github.com/joshukraine/asset-host-jquery-issue |
It would appear this is related to #1780. |
UPDATE: Found a possible workaround. Adding the # config.rb
configure :build do
activate :asset_host,
:host => '//YOURDOMAIN.cloudfront.net',
:rewrite_ignore => ["*.js"]
# More configs...
end Reference: |
Thanks. There's definitely a regex issue I need to look into |
I can't reproduce with MM github master. Can you take a look? |
Wait, nm, forgot to remove the ignore line |
Okay, give master a shot now |
@tdreyno Yep, working for me. Thanks for the fix! |
I have a couple of MM4 projects which use Gulp in conjunction with the new external_pipeline. Both projects require jQuery. I've noticed that if I activate the
asset_host
feature inconfig.rb
as outlined in the Middleman docs, the javascript bundle generated bymiddleman build
is invalid. (The error from eslint, for example, isParsing error: Unexpected token *
A similar error is displayed in the browser console in production.)The following two repos illustrate this issue. The first uses Webpack to bundle the js, the second uses Browserify. Both use Gulp and both require jQuery.
I've discussed this issue at some length with Craig Dennis (author of middleman-gulp-starter), and it would appear that the asset host URL is not being properly quoted in the bundled javascript.
If I remove the
asset_host
setting, the javascript bundle is valid. Also, if I don't require jQuery, the javascript bundle is valid. But if I combine the two, I get syntax errors. Any thoughts?Thank you.
The text was updated successfully, but these errors were encountered: