我即将在Godaddy托管上上传。我刚刚用Laravel API和React JS for UI创建了一个应用程序。我已经使用了“ laravel预设反应”来在laravel项目中使用反应。我想知道如何将该项目上传到Godaddy托管以使其生效。
如果我创建一个zip文件并将其上传到服务器,则由于zip中也包含了node_modules,项目的大小将变大。
下面是我的package.json
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "npm run development -- --watch",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.18",
"babel-preset-react": "^6.23.0",
"bootstrap": "^4.0.0",
"browser-sync": "^2.26.3",
"browser-sync-webpack-plugin": "^2.0.1",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^2.0",
"lodash": "^4.17.5",
"popper.js": "^1.12",
"react": "^16.2.0",
"react-dom": "^16.2.0"
},
"dependencies": {
"loadjs": "^3.5.5",
"npm": "^6.4.1",
"react-router-dom": "^4.3.1"
}
}
下面是我的webpack.mix.js
let mix = require('laravel-mix');
mix.react('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
mix.browserSync('http://localhost:8000');
下面的文件(index.blade.php)包含react应用容器:
<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Basic Page Needs -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Project</title>
<meta name="keywords" content="Organic, Fresh Food, Farm Store">
<!-- Favicon -->
<link rel="shortcut icon" href="img/favicon.png" type="image/png">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
<!-- Vendor CSS -->
<link rel="stylesheet" href="{{URL::asset('/libs/bootstrap/css/bootstrap.css')}}" type="text/css">
<link rel="stylesheet" href="{{URL::asset('/libs/font-awesome/css/font-awesome.min.css')}}" type="text/css">
<!-- Template CSS -->
<link rel="stylesheet" href="{{URL::asset('css/style.css')}}" rel="stylesheet" type="text/css">
<!-- App Css
<link href="{{URL::asset('css/app.css')}}" rel="stylesheet" type="text/css"> -->
</head>
<body class="home home-4">
<div class="all">
<div id="app"></div>
</div>
<!-- App JS -->
<script src="{{URL::asset('js/app.js')}}" ></script>
<!-- Vendor JS -->
<script src="{{URL::asset('/libs/jquery/jquery.js')}}"></script>
<script src="{{URL::asset('/libs/bootstrap/js/bootstrap.js')}}"></script>
<!-- Template JS -->
<script src="{{URL::asset('js/main.js')}}"></script>
</body>
</html>
任何帮助将不胜感激!