3 Star 1 Fork 0

Eric/文库小程序

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.mix.js 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
Eric 提交于 2018-11-12 09:19 . first commit
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,
},
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/aviouy/library_applet.git
[email protected]:aviouy/library_applet.git
aviouy
library_applet
文库小程序
master

搜索帮助