代码拉取完成,页面将自动刷新
const {mix} = require('laravel-mix');
const path = require('path');
/*
|--------------------------------------------------------------------------
| 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 your application, as well as bundling up your JS files.
|
*/
let networkInterfaces = require('os').networkInterfaces();
let host;
if (networkInterfaces.en0) {
for (let i of networkInterfaces.en0) {
if (i.family === 'IPv4') host = i.address;
}
} else {
host = '127.0.0.1';
}
const rules = [];
if (mix.inProduction()) {
mix.version();
} else {
rules.push({
test: /\.(js|vue)$/,
loader: 'eslint-loader',
enforce: 'pre',
exclude: /(node_modules)/,
options: {
fix: true,
formatter: require('eslint-friendly-formatter'),
},
});
}
mix
.setPublicPath('public')
.js('resources/assets/admin/app.js', 'static/js/admin.js')
.sass('resources/assets/admin/scss/app.scss', 'static/css/admin.css')
// .js('resources/assets/web/app.js', 'static/js/web.js')
// .sass('resources/assets/web/scss/app.scss', 'static/css/web.css')
// .sourceMaps(true, 'source-map') //源代码调试专用,开启会导致编译过慢
.webpackConfig({
output: {
publicPath: process.argv.includes('--hot') ? 'http://' + host + ':8080/' : '/',
// chunkFilename: 'static/js/[name]' + (mix.inProduction() ? '.[chunkhash]' : '') + '.js',
chunkFilename: 'static/chunk/[name].js' + (mix.inProduction() ? '?[chunkhash]' : ''),
},
module: {
rules,
},
resolve: {
alias: {
'axios': 'axios/dist/axios.min.js',
},
modules: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'resources/assets'),
],
},
devServer: {
host,
},
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。