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

Transpile before publish #135

Closed
McPo opened this issue Oct 19, 2016 · 7 comments
Closed

Transpile before publish #135

McPo opened this issue Oct 19, 2016 · 7 comments
Assignees
Labels
non issue Issue is not a problem or requires changes

Comments

@McPo
Copy link

McPo commented Oct 19, 2016

Would there be an appetite to transpile the codebase using babel before publishing it.

Currently an error is caused by UglifyJS on this library due to its use of ES6 'let'. Which UglifyJS seems to trip over. Its also fairly standard practice to transpile before publishing (or at least all my other dependencies do).

This is ultimately an UglifyJS issue but they seem slow to support ES6, transpiling would solve the issue for now.

ERROR in bundle.js from UglifyJs
SyntaxError: Unexpected token: name (wwwAuthenticate) [./~/boom/lib/index.js:161,0]
@Marsup
Copy link
Contributor

Marsup commented Oct 19, 2016

This has been answered many times over, that's a no. Why aren't you using babel-minify or babili instead of a 2yo tool ?

@McPo
Copy link
Author

McPo commented Oct 19, 2016

Yeah thats my bad, I keep forgetting to check closed issues considering github shows open issues by default. Sorry about that. Heres the issue I duplicated, for the interest of other users #104. (It actually pointed me in the right direction)

Im using the electron-react-boilerplate project, which was setup with babel and webpack etc. Im still quite new to JS development so Im not that familiar with all the tools.

This project was the dependency of another project which is why I was a bit too quick to open the issue (For some reason, I didn't expect the project to be as popular as it is, and thought it only had two issues). I also ran into this issue with other projects a couple of weeks back, and didn't find a catch all solution. They ended up just transpiling the project. I was also following the release of UglifyJS#harmony, which was supposed to support ES6, but resolve my issue.

However I ended up finding the catch-all solution.

The webpack config was set to ignore node_modules. The simple solution was to change:

{
    test: /\.jsx?$/,
    loaders: ['babel-loader'],
    exclude: /node_modules/
}

to

{
    test: [/node_modules\/(?:boom|hawk|hoek|cryptiles|sntp)\/lib\/(?:.+).js/],
    loaders: ['babel-loader']
},
{
    test: /\.jsx?$/,
    loaders: ['babel-loader'],
    exclude: /node_modules/
}

With the | operator specifying multiple projects which need transpiled. I initially thought it was some implicit property of transpilers to not touch node_modules, where as it was my build system stating not too.

Sorry for the inconvenience.

@McPo McPo closed this as completed Oct 19, 2016
@Marsup
Copy link
Contributor

Marsup commented Oct 19, 2016

Why would you need to transpile it at all using electron, doesn't it already have an almost fully ES6-compliant engine ?

@Marsup Marsup added the non issue Issue is not a problem or requires changes label Oct 19, 2016
@Marsup Marsup self-assigned this Oct 19, 2016
@McPo
Copy link
Author

McPo commented Oct 19, 2016

It does, however UglifyJS doesn't.

As soon as I get some spare time, Ill be ripping out the build system and replacing it with a much simpler one. I have a feeling theres a lot of technology being used which is aimed more towards the front-end web than a desktop electron app. i.e. inlining images below a certain size to improve performance etc.

However I needed something to get me started quickly and wasn't knowledgeable enough to determine what I did and didn't need. I have a bit more of a clue now.

@Marsup
Copy link
Contributor

Marsup commented Oct 19, 2016

I'm not a specialist but I don't think uglify is useful at all in your case since you're not having any network requests.

@McPo
Copy link
Author

McPo commented Oct 19, 2016

Yeah Im of the same mind. Although UglifyJS also obfuscates the code (Although its debatable if its of any real use), and Id hate to remove it now. It will probably get dumped when I get around to rewriting the build script.

Thanks,
Emmet

@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
non issue Issue is not a problem or requires changes
Projects
None yet
Development

No branches or pull requests

2 participants