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

Importing Accordion.js into Webpack2 build isn't Uglifying #1969

Closed
thoughtassassin opened this Issue Jun 8, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@thoughtassassin

thoughtassassin commented Jun 8, 2017

Description

Recently the build of my project breaks when it is building a bundle.js. Uglifying fails. The error is:

[INFO] ERROR in bundle.js from UglifyJs
[INFO] Unexpected character '`' [./~/uswds/src/js/components/accordion.js:11,0][bundle.js:56897,18

Steps to reproduce the issue

  1. Import Accordion from node_modules
  2. Use the following module rule:
           {
                test: path.join(__dirname, '.'),
                loader: 'babel-loader',
                exclude: /(node_modules)/,
                query: {
                    cacheDirectory: true,
                    presets: ['es2015', 'react']
                }
            }
@AndreaSigz

This comment has been minimized.

Show comment
Hide comment
@AndreaSigz

AndreaSigz Jun 12, 2017

Contributor

Thx @thoughtassassin. @donjo or @msecret have any thoughts on this?

Contributor

AndreaSigz commented Jun 12, 2017

Thx @thoughtassassin. @donjo or @msecret have any thoughts on this?

@toolness

This comment has been minimized.

Show comment
Hide comment
@toolness

toolness Jul 13, 2017

Contributor

Hey, sorry for the late reply here... I'm guessing this might be an issue with babel/webpack configuration--judging by the unexpected character it's running into, it might not be transpiling the code to es5 before passing it on to uglify? Another way to determine this may be by not uglifying it and checking the output--if it contains string template literals (search for the backtick character) then it likely hasn't been transpiled to es5.

Based on the module rule you provided, it seems like it should be transpiled to es5, but webpack/babel can be extremely finicky about configuration; I've spent hours debugging my own configurations, unfortunately.

If you need further help, could you upload a ZIP file containing a minimum project that reproduces the error?

Contributor

toolness commented Jul 13, 2017

Hey, sorry for the late reply here... I'm guessing this might be an issue with babel/webpack configuration--judging by the unexpected character it's running into, it might not be transpiling the code to es5 before passing it on to uglify? Another way to determine this may be by not uglifying it and checking the output--if it contains string template literals (search for the backtick character) then it likely hasn't been transpiled to es5.

Based on the module rule you provided, it seems like it should be transpiled to es5, but webpack/babel can be extremely finicky about configuration; I've spent hours debugging my own configurations, unfortunately.

If you need further help, could you upload a ZIP file containing a minimum project that reproduces the error?

@maya

This comment has been minimized.

Show comment
Hide comment
@maya

maya Mar 14, 2018

Member

Closing since there's no response from the issue opener.

Member

maya commented Mar 14, 2018

Closing since there's no response from the issue opener.

@maya maya closed this Mar 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment