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

Publish autobahn-js-built to npm #306

Closed
manas-chaudhari opened this issue Jun 1, 2017 · 13 comments
Closed

Publish autobahn-js-built to npm #306

manas-chaudhari opened this issue Jun 1, 2017 · 13 comments
Assignees

Comments

@manas-chaudhari
Copy link

manas-chaudhari commented Jun 1, 2017

I get this error when creating production build.

Failed to compile.

static/js/main.955798b7.js from UglifyJs
Unexpected token: name (Simple) [./~/cbor/lib/simple.js:9,0][static/js/main.955798b7.js:10295,6]

error Command failed with exit code 1.

Content at static/js/main.955798b7.js:10295,6

class Simple {
      ^

Instructions to reproduce:

create-react-app test
cd test
yarn add autobahn

# In src/App.js, append the following line: 
import autobahn from 'autobahn';

yarn run build

I am very new to this. Here are my thoughts:
I think the discussion is facebook/create-react-app#984 (comment) is relevant here. It mentions that ES6 syntax in dependencies is not supported by create-react-app. If that's the case, can we transpile before publishing the autobahn npm module?

@adrlen
Copy link

adrlen commented Jun 7, 2017

Ok so the problem is hildjj/node-cbor is ES6 and UglifyJS doesn't support it. It should be transpiled by Babel but I'm not sure when this must be done..

@adrlen
Copy link

adrlen commented Jun 16, 2017

@oberstet Do you have any info on this topic ? Thanks for your time.

@oberstet
Copy link
Contributor

@adrlen Sorry, I don't have info on that and no time to look into this also. Autobahn officially supports 2 ways of use and distribution:

  1. browsers: pre-built library from https://github.com/crossbario/autobahn-js-built
  2. Node: npm

@glortho
Copy link

glortho commented Jul 19, 2017

We've had so many struggles getting autobahn to work with webpack that we should've stopped trying a long time ago. But we're committed to a predictable, ergonomic strategy for package bundling, versioning, etc. so this is our solution to the latest quagmire:

webpack.config.js

{
  test: /\.js$/,
  include: /mySrcDir|cbor/,
    use: {
      loader: 'babel-loader',
      ...
}

Note that if you're using create-react-app, this solution requires ejecting.

@offroff
Copy link

offroff commented Aug 17, 2017

I manually copied the pre-built library to my create-react-app. That works but it's not a good solution in the long run. Can you publish the pre-built version to the npm registry?

@adrlen
Copy link

adrlen commented Aug 23, 2017

Actually, there is already an old pre-build version published on npmjs by a random stranger.
https://www.npmjs.com/package/autobahn-js-built

@oberstet Why isn't this repo published on npm by your team ?

@oberstet
Copy link
Contributor

@adrlen as we don't have to intro code changes for this (to support yet another JS build thingy), we could push autobahn-js-built to npm of course when doing a release to this repo with low effort, yes.

ok, we probably should given this seems to be of interest to quite some developers, and before people use stuff released by strangers, definitely.

@oberstet oberstet reopened this Aug 23, 2017
@oberstet oberstet changed the title Build fails when using create-react-app Publish autobahn-js-built to npm Aug 23, 2017
@oberstet
Copy link
Contributor

we might need some mods to the packge.json in https://github.com/crossbario/autobahn-js-built

maybe a Makefile with a "publish" target that invokes npm publish

apart from that, this step of releasing also the browser built version to npm should then be documented in https://github.com/crossbario/autobahn-js/blob/master/doc/release-process.md

@adrlen
Copy link

adrlen commented Aug 23, 2017

Might be worthy to be mentioned here too ?

https://github.com/crossbario/autobahn-js#browser-development

Thanks !

@karser
Copy link

karser commented Sep 13, 2017

autobahn-js-built v0.11.2 doesn't contain ES6:

npm install --save autobahn@git://github.com/crossbario/autobahn-js-built.git#v0.11.2
npm install --save-dev @types/autobahn

@adrlen
Copy link

adrlen commented Mar 16, 2018

Any news about this ?

Thanks again for this great lib !

@oberstet
Copy link
Contributor

Ok, I've added steps to release the browser build to npm, and pushed v18.3.1 : https://github.com/crossbario/autobahn-js-browser#using-with-npm

@adrlen
Copy link

adrlen commented Mar 16, 2018

Thanks a lot!

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

No branches or pull requests

7 participants