123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- const mix = require('laravel-mix');
- mix.copy('resources/assets/statics/public', 'public');
- mix.js('resources/assets/js/main/app.js', 'js/app.js');
- mix.sass('resources/assets/sass/app.scss', 'css');
- mix.webpackConfig({
- output: {
-
- chunkFilename: 'js/build/[name].js?[hash:8]',
- },
- devServer: {
- disableHostCheck: true,
- },
- module: {
- rules: [{
-
- test: /(\.(png|jpe?g|gif)$|^((?!font).)*\.svg$)/,
- loaders: [
- {
- loader: 'file-loader',
- options: {
- name: path => {
- path = path.replace(/\\/g, '/');
-
- try {
- if (/\/resources\/assets\//.test(path)) {
- let file = path.substring(path.indexOf('/resources/assets/') + '/resources/assets/'.length);
- if (file) {
- if (file.substring(0, 3) === 'js/') file = 'pages/' + file.substring(3);
- if (file.substring(0, 7) === 'images/') file = file.substring(7);
- return 'images/' + file + '?[hash:8]'
- }
- }
- } catch (e) { }
-
- if (!/node_modules|bower_components/.test(path)) {
- return (
- Config.fileLoaderDirs.images + '/[name].[ext]?[hash:8]'
- );
- }
- return (
- Config.fileLoaderDirs.images + '/vendor/' + path.replace(
- /((.*(node_modules|bower_components))|images|image|img|assets)\//g,
- ''
- ) + '?[hash:8]'
- );
- },
- publicPath: Config.resourceRoot
- }
- }, {
- loader: 'img-loader',
- options: Config.imgLoaderOptions
- }
- ]
- }, {
-
- test: /(\.(woff2?|ttf|eot|otf)$|font.*\.svg$)/,
- loader: 'file-loader',
- options: {
- name: path => {
- path = path.replace(/\\/g, '/');
-
- try {
- if (/\/resources\/assets\//.test(path)) {
- let file = path.substring(path.indexOf('/resources/assets/') + '/resources/assets/'.length);
- if (file) {
- if (file.substring(0, 3) === 'js/') file = 'pages/' + file.substring(3);
- if (file.substring(0, 7) === 'fonts/') file = file.substring(7);
- return 'fonts/' + file + '?[hash:8]'
- }
- }
- } catch (e) { }
-
- if (!/node_modules|bower_components/.test(path)) {
- return Config.fileLoaderDirs.fonts + '/[name].[ext]?[hash:8]';
- }
- return (
- Config.fileLoaderDirs.fonts + '/vendor/' + path.replace(
- /((.*(node_modules|bower_components))|fonts|font|assets)\//g,
- ''
- ) + '?[hash:8]'
- );
- },
- publicPath: Config.resourceRoot
- }
- }]
- }
- }).options({
- uglify: {
- uglifyOptions: {
- compress: { inline: false }
- }
- },
- hmrOptions: {
- port: '8088'
- }
- });
|