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

List of Issues/Errors and fixes for Windows users (and possibly others) #71

Open
gpspake opened this issue Jul 5, 2017 · 5 comments
Open

Comments

@gpspake
Copy link

gpspake commented Jul 5, 2017

I'm currently using Windows (ugh) which is a complete nightmare but, considering there are bound to be other folks using it, here's my experience with a fresh clone of master as well as some notes and references. I'll keep this post up to date with additional fixes and issues as they roll in.

Current status: es2015 preset must be installed and added to .babelrc to prevent SyntaxError: Unexpected token import and build.

Environment:

  • Windows 10
  • Node v6.10.3
  • Tested with Git Bash (MingW) and CMD
  • Make sure your gitconfig is set to check out with the correct line endings git config --global core.autocrlf input

Steps to Reproduce:

git clone git@github.com:btholt/complete-intro-to-react.git
cd complete-intro-to-react
yarn install
yarn dev

  • Error
    NODE_ENV not recognized
    Fix
    update dev script in to package.json to:
    "dev": "SET NODE_ENV=development && nodemon server.js",

yarn dev

  • Error
    SyntaxError: Unexpected token import
    It seems like webpack isn't honoring the "dev" prefix
    Fix
    To get this working in Windows, I had to add the babel es2015 preset:
    yarn add babel-preset-es2015 --dev
    and add the preset to my .babelrc:
    "presets": [
      "react",
      "es2015",
      ["env", {
      ...
    

yarn dev

At this point the app builds and works correctly. A coworker was able to get this to build without the need to add that preset; I don't understand yet how that's possible. Without that preset, is it supposed to be using the "env" preset that loads the "transform-es2015-modules-commonjs" plugin? If that's the case, why wouldn't babel honor that configuration on my machine?

There's still an error here but it doesn't prevent the app from working.

Currently, I'm unable to complete a dev build in Windows from a fresh clone of master. Interested to hear whether any Windows users have gotten this to work.

@gpspake
Copy link
Author

gpspake commented Jul 5, 2017

Updates:
This morning I pulled down a copy of master on OSX and it built on the first try. I still get those TypeError: require.ensure is not a function errors but the app is working.
It seems, based on some research, that the root cause of the html in my bundle.js is that Babel is trying to process es2015 before react and I think that's happening because of my "hacky" brute force fix to the second error above. I'm working with a couple of other folks today to see if we can get this working on Windows.

@gpspake
Copy link
Author

gpspake commented Jul 5, 2017

Updates:
I was able to get the app working by installing the babel-es2015 preset and adding it to my .babelrc. I shouldn't have to do this; it seems like it's because Babel isn't honoring the "env" preset defined in .babelrc. Anyone know why that would happen?

@alexwebbb
Copy link

same errors, I am on windows

@diazweb
Copy link

diazweb commented Nov 7, 2017

About the error #65, it happens also on Mac

@dannypule
Copy link

I have posted a fix for the require.ensure issue here #65

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

No branches or pull requests

4 participants