outlandishideas/kasia

Uncaught SyntaxError: Unexpected identifier on Kasia import

luandro opened this issue · 3 comments

By just including Kasia:

import Kasia from 'kasia';

I get an error on :

Uncaught SyntaxError: Unexpected identifier

Pointing to:

export const RequestTypes = {
  // Requesting a single entity from the WP API
  Post: 'Post',
  // Requesting arbitrary data from the WP API
  Query: 'Query'
}

Are you using a bundler? Perhaps it is looking at "jsnext:main" in the package.json but you are not using a transpiler like Babel to convert the ES6 module syntax to CommonJS?

If that's not helpful, please provide some details of how I can reproduce this and I will take a look into it.

Hey, I'm using Webpack, with Babel. A clone of react-boilerplate. Should I add something in webpack config?

I guess inverting the order in Webpack config from:

mainFields: [
      'jsnext:main',
      'main',
    ],

To:

mainFields: [
      'main',
      'jsnext:main',
    ],

Solved the issue.