dimanche 3 septembre 2017

CKEDITOR has incorrect basepath when using NPM & Laravel Mix

When I attempt to include CKEDITOR into my new Laravel 5.5 project using NPM, I get the following error in Chrome Console (using laravel Valet for the local.dev):

app.js:16991 GET http://ift.tt/2wyIxEZ 
app.js:16991 GET http://ift.tt/2vCW80I 
app.js:16991 GET http://ift.tt/2wyPSE8 

My Laravel Mix setup looks like this:

mix.js('resources/assets/js/app.js', 'public/js')
  .babel(['resources/assets/js/libraries/*.js'], 'public/js/vendor.js')
  .version();

My CKEDITOR installation is located in:

/vendor/ckeditor/ckeditor

I am able to access the CKEDITOR instance when the site has loaded. However, as displayed above, when I navigate to https://local.dev/chart, CKEDITOR now looks for the config, skin, and lang files with /chart appended to it's basepath.

I did some research, and found some related issues and was able to change the base_path using asset() successfully. The related stackOverflow questions can be found here and here.

What I would like to do is pull CKEDITOR in through NPM, use Laravel Mix to combine, version, and minify my scripts (one for vendor libraries, one for my app-specific JS), and then output those two.js files to these directories in the laravel app:

 /public/js/vendor.js
 /public/js/app.js

Laravel mix produces these two files, builds successfully, and all other libraries play nicely. However, CKEDITOR loses it's base path and throws errors looking for skins / langs / config.js -- any idea how I can adjust CKEDITOR's basePath to point to the vendor files so that it'll stop squaking these errors and work correctly?

Thanks you in advance for any assistance you can provide!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire