This is the story of how I found a bug preventing this project from being built, cursed a lot, fixed the bug, but then discovered another bug, and eventually gave up. I hope you do not take any of this personally. I really appreciate your work and the fact that it's free and open source. Sorry for dumping all of this on you
First problem: can't npm run build
Steps to produce error:
git clone https://github.com/developit/preact-compat-example.git
cd preact-compat-example
npm install
npm run build
Expected: it should work
Actual: it does not.
This error happened for me on macOS El Capitan, with Node v6.3.0 and v4.4.7. Normally I would include an error log, but the error log is way too long. Here are some of the last few lines from my terminal, which illustrate the repetitive nature of the errors:
ERROR in ./~/css-loader?sourceMap&modules&importLoaders=1&localIdentName=[local]__[hash:base64:5]!./~/postcss-loader!./~/sass-loader?sourceMap!./~/toolbox-loader!./~/source-map-loader!./~/react-toolbox/lib/animations/zoom-out.scss
Module build failed:
@import "./colors";
^
Import directives may not be used within control directives or mixins.
in /Users/james/preact-compat-example/node_modules/react-toolbox/lib/_base.scss (line 4, column 3)
Child extract-text-webpack-plugin:
+ 1 hidden modules
ERROR in ./~/css-loader?sourceMap&modules&importLoaders=1&localIdentName=[local]__[hash:base64:5]!./~/postcss-loader!./~/sass-loader?sourceMap!./~/toolbox-loader!./~/source-map-loader!./~/react-toolbox/lib/animations/zoom-in.scss
Module build failed:
@import "./colors";
^
Import directives may not be used within control directives or mixins.
in /Users/james/preact-compat-example/node_modules/react-toolbox/lib/_base.scss (line 4, column 3)
After some Googling, I thought I might be able to fix the issue by updating the dependencies, so I looked at the output from npm outdated
and ran this to update everything:
npm i sass-loader@4 react-toolbox@1 preact-router@2 [email protected] normalize.css@4 html-webpack-plugin@2 extract-text-webpack-plugin@1 babel-preset-es2015-minimal@2
This seemed to work, but when I ran npm run build
I noticed this text in red:
ERROR in ./src/index.js
Module not found: Error: Cannot resolve module 'react-toolbox/lib/app' in /Users/james/preact-compat-example/src
@ ./src/index.js 11:11-43
ERROR in ./src/components/app/index.js
Module not found: Error: Cannot resolve module 'react-toolbox/lib/app' in /Users/james/preact-compat-example/src/components/app
@ ./src/components/app/index.js 9:11-43
So I started spewing expletives
I did some more Googling and found this changelog for react-toolbox which explains:
App
component is no longer needed. From now on we are blocking the body overflow
in components with Overlay
. You can stop wrapping you whole application if you want.
Eventually I remove the references to <ToolboxApp>
and both of the require()
s that were failing because the file that defined <ToolboxApp>
was deleted. I also updated the package.json dependency versions. Here is a patch that illustrates it all.
But, even though I can npm run build
without errors, there is another problem, and that's why this is an issue, not a pull request ๐ญ
Second problem: can't npm run start
I tried running npm run start
and it eventually said Visit http://0.0.0.0:8080 to view your app.
so I did, and I waited a very long time, both in Chrome and Safari Technology Preview. It took an incredibly long amount of time, but eventually I got this:
TypeError: Cannot assign to read only property 'children' of object '[object HTMLAnchorElement]'
at w (http://0.0.0.0:8080/bundle.js:2:24741)
at F (http://0.0.0.0:8080/bundle.js:2:27318)
at A (http://0.0.0.0:8080/bundle.js:2:26164)
at I (http://0.0.0.0:8080/bundle.js:2:26681)
at A (http://0.0.0.0:8080/bundle.js:2:26155)
at I (http://0.0.0.0:8080/bundle.js:2:26681)
at A (http://0.0.0.0:8080/bundle.js:2:26155)
at H (http://0.0.0.0:8080/bundle.js:2:28820)
at H (http://0.0.0.0:8080/bundle.js:2:28702)
at Y (http://0.0.0.0:8080/bundle.js:2:29472)
[many more expletives were said]
I stopped that process and ran cd build; python -m SimpleHTTPServer 8000
hoping that maybe it was just a timing issue. I went to http://localhost:8000
and I got the exact same error.
If it's any help, the page contained things like {% if (o.htmlWebpackPlugin.files.favicon) { %}