-
Notifications
You must be signed in to change notification settings - Fork 356
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
Using react router breaks the app #228
Comments
Hi @rukshn, thank you for your feedback. This is a known problem. We changed the url to relative to make the output work correctly in subdirectories. Unfortunately this clashes with react router. We will revert the setting back to absolute mode (as you have suggested, too) in a next patch version. |
Hi @weblogixx if it's a known issue then it's fine I guess. Another thing I noted is that it also breaks hot reloading. Getting the following warning at console.
|
Hi @rukshn, this is related to the same error :(. Please remove the "." in cfg/base.js: module.exports = {
additionalPaths: additionalPaths,
port: defaultSettings.port,
debug: true,
devtool: 'eval',
output: {
path: path.join(__dirname, '/../dist/assets'),
filename: 'app.js',
publicPath: `.${defaultSettings.publicPath}` // <- Remove the leading dot!
}, Hope this helps. |
…act-webpack-generators/generator-react-webpack#228) Updated package dev dependencies to latest stable (karma-coverage, karma-mocha) Updated karma.conf.js to set test env automatically, adjusted run port to match default webpack port (8000 instead 8080)
Hi @rukshn, this was fixed with react-webpack-template@1.7.0. After upgrading your generators dependencies (npm update -g with global install), new projects will have this back as default. Thanks again for your input. |
Hi, I'm using react router together with this yeoman generator. So when using a react router with multiple nester routers such as this,
<Route path="/story/:sid" component={StoryComponent} />
I get the following error when a URL such as this '/story/1' is loaded on the browser.
http://localhost:8000/story/assets/app.js 404 (Not Found)
I guess the problem is here,
Changing this at index.html
<script type="text/javascript" src="./assets/app.js"></script>
To
<script type="text/javascript" src="/assets/app.js"></script>
Seems to fix the problem. So what should we do about this?
The text was updated successfully, but these errors were encountered: