Skip to content

Instantly share code, notes, and snippets.

@lighth7015
Created August 23, 2018 10:36
Show Gist options
  • Save lighth7015/803c4448404ef2ef6347dca418b9c8a8 to your computer and use it in GitHub Desktop.
Save lighth7015/803c4448404ef2ef6347dca418b9c8a8 to your computer and use it in GitHub Desktop.
laravel-mix configuration
const mix = require('laravel-mix');
const sprintf = require('locutus/php/strings/sprintf');
const path = require('path');
const base = 'resources/assets';
const root = (prefix = '') =>
path.resolve(__dirname, path.join('app', prefix));
const resolve = (dirname = '') => (
console.log(sprintf('resolve: %-16s => %s', dirname, path.resolve(__dirname, base, dirname))),
path.resolve(__dirname, 'resources/assets', dirname));
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| your Laravel application. By default, we compile the Sass file for the
| application as well as bundling up all the JS files.
|
*/
mix.webpackConfig({
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.ts?$/,
loader: 'babel-loader',
options: {
presets: [ 'env' ]
}
},
{
test: /\.html$/,
loader: 'raw-loader'
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader'
}
]
},
resolve: {
alias: {
'@base': resolve(),
'@app': resolve('app'),
'@views': resolve('views'),
'@store': resolve('store'),
'@components': resolve('components'),
'@shared': resolve('shared'),
'@plugins': resolve('shared/plugins'),
'@services': resolve('shared/services'),
'@styles': resolve('shared/styles')
},
extensions: [ '.js', '.ts' ]
}});
mix.options({
extractVueStyles: 'public/styles/base.css',
processCssUrls: false,
imgLoaderOptions: {
enabled: false
},
uglify: {
compress: false,
mangle: false,
},
uglifyCss: false,
postCss: [
require('autoprefixer')
],
clearConsole: true
})
.ts('resources/assets/app.ts', 'public/PharmAssist')
// .stylus('node_modules/vuetify/src/stylus/main.styl', 'public/WebCore/PharmAssist')
// .sourceMaps()
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment