Closed bobvandevijver closed 5 years ago
Thank you! cc @ktherage @Lyrkan could you review this?
Ci failing is my fault, didn't merge from 2.x to master. Will do tonight
Currently, the documented rules also copy the samples folders into the build directory. We can prevent that from happening by using these rules as replacement for the first rule instead:
{from: './node_modules/ckeditor/', to: 'ckeditor/[path][name].[ext]', pattern: /\.(js|css)$/, includeSubdirectories: false},
{from: './node_modules/ckeditor/adapters', to: 'ckeditor/adapters/[path][name].[ext]'},
{from: './node_modules/ckeditor/plugins', to: 'ckeditor/plugins/[path][name].[ext]',
Shall I include this in this MR, or add a separate one?
You can do it here.
This now generates a warning on ckeditor/plugins/emoji/emoji.json
.
warning in ./node_modules/ckeditor/plugins/emoji/emoji.json
Module parse failed: Unexpected token m in JSON at position 0 while parsing near 'module.exports = __w...'
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token m in JSON at position 0 while parsing near 'module.exports = __w...'
I'm not sure why the copyFiles
function even tries to parse it, does anyone here have an idea to disable this?
Edit: Fixed with latest commit :)
I'm not sure why the copyFiles function even tries to parse it, does anyone here have an idea to disable this?
Looks like a bug to me :(
We use something like require.context('!file-loader?<params>')
to copy files, which means that all them are supposed to go through the file-loader
only...
But Webpack 4 added a special treatment for .json
file that collides with extra loaders (see https://github.com/webpack/webpack/issues/6586).
I'll try to see if something can be done in Encore to fix that but most solutions don't really apply to our case...
In the meantime I guess that your solution should work fine.
Thank @bobvandevijver! Thanks @Lyrkan for reviewing again!
@kunicmarko20 sorry I'm late :sweat_smile: I only seen your cc to me for review now
np @ktherage, I guess change is fine?
@kunicmarko20 Yes, in fact i didn't really mind myself about what may be imported and what may not. It just worked. I'm glad to see that this piece of doc leads more experimented people to make improvement on it.
Without the CSS files being copied into the build directory, a bunch of requests fail as they are missing. This change adds them to the build output.
Edit: I've also adjusted the rules to no longer include the
samples
directory.