I have created a web3 app with react. As I now need an additional centralized backend for other data operations I want to use laravel.
I have the following folder structure:
I created the following files to compile the app with mix:
webpack.mix.js:
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
/*
mix.js('resources/js/app.js', 'public/js')
.react()
.sass('resources/sass/app.scss', 'public/css');
*/
mix.js('react-app/src/App.js', 'public/js')
.webpackConfig(require('./webpack.config'))
.react()
.css('react-app/src/styles/reset.css', 'public/css')
.css('react-app/src/styles/styles.css', 'public/css')
.css('react-app/src/App.css', 'public/css')
webpack.config.js:
module.exports = {
resolve: {
fallback: {
"stream": require.resolve("stream-browserify"),
"crypto": require.resolve("crypto-browserify"),
"http": require.resolve("stream-http"),
"https": require.resolve("https-browserify"),
"os": require.resolve("os-browserify/browser"),
},
},
};
My view welcome.blade.php in laravel looks like the following:
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Laravel</title>
<!-- Styles -->
<link href="{{ asset('css/App.css') }}" rel="stylesheet">
<link href="{{ asset('css/styles.css') }}" rel="stylesheet">
<link href="{{ asset('css/reset.css') }}" rel="stylesheet">
</head>
<body>
<!-- React root DOM -->
<div id="App">
</div>
<!-- React JS -->
<script src="{{ asset('js/App.js') }}" defer></script>
</body>
</html>
The compilation works fine, but when I run the route to welcome.blade.php I get a blank page back.
Any suggestions what I am doing wrong?
I appreciate your replies!
