1

I've been trying to use the @salesforce/design-system-react, well every time I try and run it, I have this error, I've tried many react versions, and used all the considerations that they give, any idea what could be the problem?

I don't want to use a webpack version prior 4.0, any help, or someone who have done this?

> [email protected] start path\to\the\project\
> nodemon --exec babel-node server.js --ignore/public

[nodemon] 1.17.5
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `babel-node server.js --ignore/public`
path\to\the\project\node_modules\@salesforce\design-system-react\components\global-header\index.jsx:12
import React from 'react';
^^^^^^

SyntaxError: Unexpected token import
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Module._extensions..js (module.js:663:10)
    at Object.require.extensions.(anonymous function) [as .jsx] (path\to\the\project\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
[nodemon] app crashed - waiting for file changes before starting...

1 Answer 1

0

It looks like you are not transpiling the JavaScript from ES6 down to something that webpack or the browser can read like ES5. You will want to use the CommonJS import style for all imports. That will link you to a copy of all the imports that are already transpiled to something the browser can read.

All the examples on the documentation site are written using source code and the moment which requires Babel to convert the Javascript.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .