question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem with webpack and react

See original GitHub issue

Describe the bug

Impossible to load a unity canvas:

image

Desktop (please complete the following information):

  • Browser [chrome, Firefox]

Additional context we used webpack cli: “webpack”: “^4.15.1”, “webpack-cli”: “^3.0.8”, “webpack-dev-server”: “^3.1.4”

in webpack we have:

new CopyWebpackPlugin([ {from:‘src/assets’,to:‘assets’}, {from:‘src/skins’,to:‘skins’}, {from:‘src/images’,to:‘images’}, {from:‘src/fonts’,to:‘fonts’}, {from:‘src/i18n’,to:‘i18n’}, {from:‘src/webGL’,to:‘webGL’} ])

in our structure we have:

scr/webGL

inside: Build/
TemplatesData index.html

and this init component:

this.unityContent = new UnityContent( "webGL/Build/webGl.json", "webGL/Build/UnityLoader.js" );

whats wrong!??! there is a webpack problem?

we don’t have a public folder…

output: { filename: 'main.js', path: path.resolve(__dirname, '..', 'dist'), publicPath: '/' // necessary for HMR to know where to load the hot update chunks },

please help…

thanks a lot

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
robertobrogicommented, Jun 26, 2019

ooooooooooo fix it… was a error in webpack…

the problem was here:

devServer: { hot: true, // enable HMR on the server port: 3000, historyApiFallback: true, contentBase: path.resolve(__dirname, '..', 'src', 'scripts'), // match the output path publicPath: '/' // match the output publicPath },

replace with:

devServer: { hot: true, // enable HMR on the server port: 3000, historyApiFallback: true, contentBase: path.resolve(__dirname, '..', 'src'), // match the output path publicPath: '/' // match the output publicPath },

and i have removed:

new CopyWebpackPlugin([ {from:'src/assets',to:'assets'}, {from:'src/skins',to:'skins'}, {from:'src/images',to:'images'}, {from:'src/fonts',to:'fonts'}, {from:'src/i18n',to:'i18n'}, {from:'src/webGL',to:'webGL'} ])

thanks a lot for the supprt

0reactions
jeffreylanterscommented, Jun 26, 2019

Awesome! Have fun!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack error with react - Stack Overflow
import Component from `./components/component.jsx`. It wasn't a config error at all. I'm on babel 6 with hot loader.
Read more >
Webpack 5 errors | ImmutableX Documentation
The reason for this error is that create-react-app uses a version of webpack greater than 5, which, unlike versions < 5, does not...
Read more >
REACT 18 + WEBPACK 5: Compiling Errors · Issue #3418
Describe the bug. Two Compiling Error with REACT 18 and Webpack 5: ; Reproduction ; Expected behavior. No Errors in compiling. No need...
Read more >
How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >
When using react.js webpack-dev-server does not bundle
I'm going to help you start a react project and reproduce this problem just so you understand when and why does this happen....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found