purescript-react / purescript-lumi-components

Library of our UI components
https://lumihq.github.io/purescript-lumi-components/#/
Apache License 2.0
105 stars 5 forks source link

Unexpected token HashRouter. #163

Open philderbeast opened 4 years ago

philderbeast commented 4 years ago

I followed the steps for local development from the readme and saw the following error.

> npm i
> npx bower i
> npx pulp build
> npm start
...
* Building project in /.../purescript-lumi-components
ℹ 「wds」: Project is running at http://0.0.0.0:3000/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /.../purescript-lumi-components
✖ 「wdm」:    33 modules

ERROR in ./docs/index.jsx 8:2
Module parse failed: Unexpected token (8:2)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
See https://webpack.js.org/concepts#loaders
|
| ReactDOM.render(
>   <HashRouter>
|     <ScrollManager>
|       <App />
ℹ 「wdm」: Failed to compile.
           Src   Lib   All
Warnings   0     0     0
Errors     0     0     0
* Build successful.
megamaddu commented 4 years ago

Hmm, I just tried a fresh clone and didn't run into this. Perhaps an issue with npm's cache? If clearing that doesn't help can you provide more info like your OS, npx pulp --version, node --version, npm --version, and npm ls webpack?

philderbeast commented 4 years ago

Verifying the cache as npm suggests.

> npm cache clean
npm ERR! As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is
guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the
other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache`
to use a temporary cache instead of nuking the actual one.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.

> npm cache verify
Cache verified and compressed (~/.npm/_cacache):
Content verified: 4830 (315827706 bytes)
Index entries: 7316
Finished in 6.21s

Here are the versions while I try forcing a clean of the cache.

> npx pulp --version
Pulp version 13.0.0
purs version 0.13.6 using /.../purescript-lumi-components/node_modules/.bin/purs

> node --version
v14.4.0

> npm ls webpack
purescript-lumi-components@0.0.0 /Users/pdejoux/dev/src/increase/purescript-lumi-components
└── webpack@4.39.0
philderbeast commented 4 years ago

After npm cache clean --force the build reports the same error as before.

megamaddu commented 4 years ago

Very strange.. 🤔

megamaddu commented 4 years ago
[:~/dev/lumi/purescript-lumi-components] main 31s 130 ±
> npx pulp --version
Pulp version 13.0.0
purs version 0.13.6 using /Users/maddie/dev/lumi/purescript-lumi-components/node_modules/.bin/purs

[:~/dev/lumi/purescript-lumi-components] main ±
> npm ls webpack
purescript-lumi-components@0.0.0 /Users/maddie/dev/lumi/purescript-lumi-components
└── webpack@4.39.0

[:~/dev/lumi/purescript-lumi-components] main 2s ±
> npm --version
6.14.5

[:~/dev/lumi/purescript-lumi-components] main ±
> node --version
v14.3.0
megamaddu commented 4 years ago

@philderbeast Can you try commenting out this line? https://github.com/lumihq/purescript-lumi-components/blob/main/webpack.config.js#L99

philderbeast commented 4 years ago

It works for me now with that one line taken out. Thanks @spicydonuts.

philderbeast commented 4 years ago

I did a fresh clone and this time didn't encounter the error. I see the line I commented out last time for the build has not changed but I have now installed bower, pulp, purescript and spago globally. I did this to try other projects without such hermetic builds as this one.

megamaddu commented 4 years ago

Odd. I was using the npx commands so we should have been on the same local versions. I don't get why excluding unrelated folders affects whether docs/ is included 🤔