laravel-mix

Purifying css assets via laravel mix doesnt work

淺唱寂寞╮ 提交于 2020-01-06 05:08:05
问题 Description: Purifying option doesnt work while compiling css files.Can you explain what is wrong with this approach? Steps To Reproduce: This is inside my mix file: mix.style('resources/assets/css/some.css', 'public/css/some.css').options({ purifyCss: { paths: ['/home/smolen/Projects/laravel-test/resources/views/welcome.blade.php'], verbose:true, minimize:true, } }) This is my css file which stay the same after compiling: .unused-class{ color:red; } .used-class{ color:blue; } ``` This is in

The Mix manifest does not exist when it does exist

蓝咒 提交于 2019-12-31 09:17:07
问题 For my admin panel I extract all the assets including the manifest-json.js to mix.setPublicPath(path.normalize('public/backend/')) . All the files get correctly added to the backend folder, and the manifest-json.js file looks as follows: { // all correct here "/js/vendor.js": "/js/vendor.js", "/js/app.js": "/js/app.js", "/css/app.css": "/css/app.css", "/js/manifest.js": "/js/manifest.js" } the problem is that when using {{ mix('backend/css/app.css') }} in my blade-files, it looks in public

laravel npm run dev ERR! code ELIFECYCLE Failed at the @ development script

萝らか妹 提交于 2019-12-25 02:46:11
问题 i'm trying to run npm run dev but it failed node ver: 11.2.0, npm ver: 6.4.1, os:windows10 it gives out this error: > @ dev C:\xampp\htdocs\laravel\tutorial > npm run development > @ development C:\xampp\htdocs\laravel\tutorial > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 70% building 12/18 modules 6 active ...utorial\node_modules\axios\lib\axios.jsTypeError: dep.getResourceIdentifier

Laravel Mix Uncaught ReferenceError: $ is not defined

时间秒杀一切 提交于 2019-12-24 04:35:11
问题 I've searched and searched and I can't find the answer to my problem on SO. So here's my issue. I'm trying to load jQuery Globally using Laravel Mix. I've tried modifying all sorts of files, and nothing seems to be working... I'm still getting the "$ is not defined" error. Here's my code. Bootstrap.js window._ = require('lodash'); window.Popper = require('popper.js').default; try { window.$ = window.jQuery = require('jquery'); require('bootstrap'); } catch (e) {} window.axios = require('axios

Vuejs browser extension without using 'unsafe-eval' in CSP

对着背影说爱祢 提交于 2019-12-24 00:37:29
问题 I have built a browser addon using Vuejs and used Laravel Mix as my build process. All of my vue templates are in single file components, and everything works absolutely fine...Until I remove 'unsafe-eval' from the CSP in my addon manifest. Firefox shows the error: Content Security Policy: The page's settings blocked the loading of a resource...Source: call to eval() or related function blocked by CSP. Laravel Mix uses webpack and vue-loader, I was under the impression that the bundles this

Laravel Mix not transpiling vendor.js to es5

拥有回忆 提交于 2019-12-24 00:33:42
问题 Laravel Mix does not seem to transpile vendor.js and manifest.js to ES5. It fails on iPhone Safari and IE 11. IE DevTools shows these errors: And it appears that it still has ES6 features: The other files seem to transpile such as app.js and the chunks. Here's my webpack.mix.js let mix = require('laravel-mix'); let options = { processCssUrls: false, } let config = { output: { chunkFilename: 'assets/js/chunks/[name].js', publicPath: '/' } } if (mix.inProduction()) { config.output.chunkFilename

True ENV Values in Laravel Mix

天大地大妈咪最大 提交于 2019-12-23 00:50:35
问题 So in Laravel Mix it says in the docs we can add stuff to our .env file prefixed with MIX_ and we can then access it in our JS file when compiled. I think I may be missing something here though because this doesn't really offer anything along the lines of an env file as the assets are compiled into production mode locally before you push them up to your server. That means the npm run watch and npm run build will both pick up the same env values right? It works as a kind of global variable

Can't read property of undefined (mix.initialize() )when use node_modules/.bin/webpack

巧了我就是萌 提交于 2019-12-22 10:44:39
问题 I'm trying to compile with node_modules/.bin/webpack and I get this error: Mix.initialize(); ^ TypeError: Cannot read property 'initialize' of undefined at Object.<anonymous> (/home/vagrant/Code/stream/webpack.config.js:9:4) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js

How to use Laravel Mix and WorkBox?

空扰寡人 提交于 2019-12-22 09:39:52
问题 I'm trying to build a PWA for my app; and have spent almost 48 hours trying to figure out how to make use of Workbox with Laravel Mix. What's ironical is that Google says Workbox is meant to make things easy! Buh! Okay, so far I've figured out that - I will need to use the InjectManifest Plugin because I want to integrate Push notifications service in my Service Worker I have no clue how to specifiy the paths for swSrc and swDest . What code should go into my webpack.mix.js and whether I

92% chunk asset optimization - webpack

大兔子大兔子 提交于 2019-12-22 03:51:26
问题 It seems that webpack gets stuck on 92% chunk asset optimization for about 30+ seconds to show a simple js/css change. This is too long for anyone sane to sit and wait that much of their life to see something that should be rendered near instantly. We're in development mode (so we need source maps, which add to the latency) but it should still NOT be 30+ seconds. Also, we're not using uglify (which I've seen mentioned on GitHub as taking up a good amount of time). How can we get the build