laravel-mix

How to include webpack plugins when using Laravel Mix?

醉酒当歌 提交于 2019-12-21 07:01:07
问题 How should I include webpack plugins if I use WebPack AND Laravel Mix? I am confused which file I add the plugin code into. My below attempt doesn't seem to be running my plugin. The plugin should be compressing the js, css files but its not. webpack.config.js : require('./node_modules/laravel-mix/src/index'); require(Mix.paths.mix()); // My plugin is here const CompressionPlugin = require('compression-webpack-plugin'); Mix.dispatch('init', Mix); let WebpackConfig = require('./node_modules

Convert ES6 to ES2015 using babel and laravel-mix

*爱你&永不变心* 提交于 2019-12-18 16:56:13
问题 I have ES6 JavaScript code in my Vue components. In order to support IE 11 I need to convert it to ES5 code using babel and laravel-mix. How do I do that? Here is my webpack.mix.js file. let mix = require('laravel-mix'); mix.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js/admin-app.js', 'public/js') 回答1: There's a mix.babel() command that can handle this. It's identical to mix.scripts() so it requires a little more legwork. I cheat and do this and then serve the es5.js

Compiling ES6 and VUE JS not working in IE 11

一笑奈何 提交于 2019-12-17 19:59:11
问题 So I am having an issue with ES6, Webpack and VUE JS in IE 11. This works in Edge, Chrome, Safari and Firefox, but not IE 11. The error: SCRIPT1002: Syntax error vue.js (16,8498) Ok, so whats at this line? (module,__webpack_exports__,__webpack_require__){"use strict";eval("/* unused harmony export getJSON */\n/* unused harmony export getScrollBarWidth */\n/* unused harmony export translations */\n/* harmony export (immutable) */ __webpack_exports__[\"b\"] = delayer;\n/* unused harmony export

Laravel Mix / Webpack environment dependent variable for client code

陌路散爱 提交于 2019-12-13 16:24:03
问题 I'm looking for a way to build my assets using Laravel Mix on my dev machine which will then match the parameters on the production. For instance, I have a base url for my API which is http://foo.test/api/v1 for local development and https://foo.com/api/v1 on my production server. So in my client code (e.g. http.js ) I would like to do something like this: Vue.axios.defaults.baseURL = API_BASE_URL; Now API_BASE_URL should get replaced with http://foo.test/api/v1 when I run npm run dev or with

laravel-mix configuration for vue-loader

房东的猫 提交于 2019-12-13 03:45:04
问题 I was trying to create a css modules using vuejs. However, I cannot figure out how to configure the webpack. Here is my Vue component <template> <div> <div :class="$style.header_top"> </div> </div> </template> <style module lang="scss"> $black: #1e1e1e; $white: #fff; .header { position: absolute; width: 100%; &_top { background-color: $black; padding: 15px 0; } .... </style> This is my laravel-mix configuration: mix.webpackConfig({ module: { rules: [ { test: /\.css$/, resourceQuery: '/module/

VueJS Router 'Failed to mount component: template or render function not defined.'

强颜欢笑 提交于 2019-12-11 07:02:23
问题 I'm following this video: https://laracasts.com/series/learn-vue-2-step-by-step/episodes/26?autoplay=true My initial problem is described here, but that was resolved. I include it here so you can see what steps I've taken so far. Now, I'm getting this warning: [Vue warn]: Failed to mount component: template or render function not defined. A warning is not so bad, but the router-view is not showing up. That is, there is nothing showing up below the Home and About links. master.blade.php <

The Mix manifest does not exist

眉间皱痕 提交于 2019-12-11 06:42:43
问题 i'm created simple laravel project with this Laravel-Vue SPA starter project template and im uploaded this project to ubuntu server. all settings corect but i run this project returns this error "The Mix manifest does not exist. (View: /var/www/html/project/resources/views/index.blade.php)". please anyone help me. i'm new in laravel. 回答1: I think it's because of that you separated your laravel files from public folder. and public_path() returns wrong path. for being sure try dd(public_path())

Laravel mix hot reload and domain name

假如想象 提交于 2019-12-11 05:32:41
问题 I use Laravel Homestead for my development environment, so my website is accessible on http://test.app Now I tried to configure laravel mix to use it with VUEJS. For this, I include a JS file in one of my templates: <script src="{{ url(mix('js/main.js'))}}"></script> The result of this is <script src="//localhost:8080/js/main.js"></script> It seems so, that the localhost:8080 is hardcoded in vendor/laravel/framework/src/Illuminate/Foundation/helper.php (see https://github.com/laravel

Understanding Webpack: why does it add these lines of javascript?

落花浮王杯 提交于 2019-12-11 04:39:02
问题 I'm learning Laravel and trying to understand how to use Laravel Mix to bundle assets (scss and javascript). As the documentation says: Laravel Mix provides a fluent API for defining Webpack build steps for your Laravel application using several common CSS and JavaScript pre-processors. I thought that Webpack would simply concatenate all the javascript files into a single one (and optionally minify it), as it does with .scss files, which are compiled into CSS and merged into public/css/app

Laravel 5.5 ReferenceError: $ is not defined

[亡魂溺海] 提交于 2019-12-10 18:28:10
问题 For some reason my jQuery refuses to load. I am getting an error: ReferenceError: $ is not defined My template is in views/layouts/editor.blade.php and I am loading jQuery in the head of my template like this <script src="{{ asset('js/jquery.min.js') }}"></script> I can see that jQuery is loaded in my console. but still I get the error. I am compiling my javascript using laravel mix and my webpack.mix.js file looks like this: // javascript mix.js('resources/assets/js/app.js', 'public/js') .js