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

Webpack build error - Module parse failed #173

Closed
polarathene opened this issue Feb 21, 2016 · 7 comments
Closed

Webpack build error - Module parse failed #173

polarathene opened this issue Feb 21, 2016 · 7 comments

Comments

@polarathene
Copy link

ERROR in ./~/stardust/src/index.js
Module parse failed: /react-project-path/node_modules/stardust/src/index.js Line 1: Unexpected token
You may need an appropriate loader to handle this file type.
| import { deprecateComponents } from './utils/deprecate'

I took a look at what babel settings were used in your .babelrc, as well as the notes on webpack loader on the README. Babel loader looks like the following:

..

webpackConfig.module.loaders = [{
  test: /\.(js|jsx)$/,
  exclude: /node_modules/,
  loader: 'babel',
  query: {
    cacheDirectory: true,
    plugins: ['transform-runtime', "add-module-exports"],
    presets: ['es2015', 'react', 'stage-0', 'stage-1'],
    env: {
      development: {
        plugins: [
          ['react-transform', {
            transforms: [{
              transform: 'react-transform-hmr',
              imports: ['react'],
              locals: ['module']
            }, {
              transform: 'react-transform-catch-errors',
              imports: ['react', 'redbox-react']
            }]
          }]
        ]
      }
    }
  }
}

..

I'm new to babel and webpack, this is taken from the webpack config in react-redux-starter-kit. I've done an npm install of the two added plugins/presets like so:

npm install --save-dev babel-preset-stage-1
npm install --save-dev babel-plugin-add-module-exports

Running the webpack server with npm start for the project brings up the mentioned error above.

@dvdzkwsk
Copy link
Member

The annoying part for right now is that you need to process Stardust with babel. If you change your exclude for the js loader to:

exclude: /node_modules\/(?!(stardust)/,

That should work as at least a temporary solution.

@polarathene
Copy link
Author

If I need to compile it, any reason a pre-compiled version isn't being made available?

@dvdzkwsk
Copy link
Member

Still a relatively young project, I don't believe they were prepared to release it to the public just yet.

@ghost
Copy link

ghost commented Feb 22, 2016

@polarathene Thanks for the issue! As @davezuko suggests it's still very much in its infancy. But the capabilities provided for client-side form validation and easily creating slick UIs is pretty incredible already. We've outlined a Roadmap for v1. Please feel free to open a pull request against that if you feel it's missing anything you'd like to see as we work towards an initial release. Meanwhile, I hope you enjoy using the project.

@ghost ghost closed this as completed Feb 22, 2016
@levithomason
Copy link
Member

@polarathene As of this PR, Stardust now includes a CommonJS build in dist/ when you install. You no longer need to build the src/ yourself.

I've also left the src/ in for backwards compatibility and the option to compile yourself if you like. Cheers!

@polarathene
Copy link
Author

@levithomason Much appreciated, thanks :)

@levithomason
Copy link
Member

No problem!

This issue was closed.
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

3 participants