laravel-mix

Error with 'import' statement without .js extension using npm module with Laravel Mix

夙愿已清 提交于 2020-12-12 12:14:26
问题 I'm using CKEditor 5 in a Laravel project, getting it from a CDN, so initially I have not needed to run npm. But now I need an alignment plugin, so I used Laravel Mix to run npm install, and then copy the plugin to public folder. Like this: mix.copyDirectory('node_modules/@ckeditor', 'public/@ckeditor'); In my code, I tried to import it: import Alignment from '/@ckeditor/ckeditor5-alignment/src/alignment.js'; So it threw this error in console Uncaught TypeError: Failed to resolve module

Laravel Mix: Configure Babel for IE11 compatibility (transformations and polyfills)

流过昼夜 提交于 2020-07-18 07:44:11
问题 In a Laravel 6 application with Laravel-Mix 4, and using the Vue preset, I need to compile my JavaScript code to be compatible for IE11. This means adding any polyfills for missing functions, compiling out arrow functions, and so on. Out of the box, this is not done. My test code in resources/js/app.js : //require('./bootstrap'); let test = [1, 2, [3, 4]]; console.log( test.flat().map((x) => 2*x) ); With default config, laravel mix does not appear to compile JavaScript code, but only do some

vue.config.js to (laravel) webpack.mix.js

China☆狼群 提交于 2020-06-10 12:31:50
问题 I started using Vue using the Vue CLI template. In that template you create a file called 'vue.config.js' to define some settings. More to find here: https://cli.vuejs.org/guide/css.html#css-modules I had a settings for an global css/sass file so all my components could access the variables (the file only contains vars). vue.config.js: module.exports = { // So we can use the template syntages in vue components (correct me if am wrong) runtimeCompiler: true, // CSS settings css: {

Delete Temp Files in Laravel Mix

廉价感情. 提交于 2020-05-29 20:04:40
问题 I'd like to remove temp build files during or after my laravel-mix build. Here's some code that I have currently, but del isn't working: const mix = require('laravel-mix'); const del = require('del'); // compile sass into temp css file mix.sass('resources/stylesheets/style.scss', 'public/css/temp.css'); // compile css mix.styles([ // other css stylesheets here... 'public/css/temp.css' // include temp css file ], 'public/css/admin.min.css'); // delete temp css file del('public/css/temp.css');

Delete Temp Files in Laravel Mix

老子叫甜甜 提交于 2020-05-29 19:59:08
问题 I'd like to remove temp build files during or after my laravel-mix build. Here's some code that I have currently, but del isn't working: const mix = require('laravel-mix'); const del = require('del'); // compile sass into temp css file mix.sass('resources/stylesheets/style.scss', 'public/css/temp.css'); // compile css mix.styles([ // other css stylesheets here... 'public/css/temp.css' // include temp css file ], 'public/css/admin.min.css'); // delete temp css file del('public/css/temp.css');

Lazy-Loaded vue-router components don't work with SSR

拥有回忆 提交于 2020-05-25 07:54:32
问题 I have two different entry points for server.js and client.js.(I'm using vue-server-renderer and laravel-mix) - (my server.js and client.js looks exactly like described here - spatie/laravel-server-side-rendering and if I make static export import Test from '../views/Test' it works.. If I try importing the route without lazy loading, SSR works: import Test from "../views/Test"; export const routes = [{ path: '/my-route', name: "Test", component: Test, }] But if I try lazy-loading, it fails on