Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

bobvandevijver
Copy link
Contributor

@bobvandevijver bobvandevijver commented Mar 8, 2019

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.

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Fixed tickets
License MIT

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.
@kunicmarko20
Copy link
Contributor

Thank you! cc @ktherage @Lyrkan could you review this?

@kunicmarko20
Copy link
Contributor

Ci failing is my fault, didn't merge from 2.x to master. Will do tonight

@bobvandevijver
Copy link
Contributor Author

bobvandevijver commented Mar 8, 2019

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?

@kunicmarko20
Copy link
Contributor

You can do it here.

@bobvandevijver
Copy link
Contributor Author

bobvandevijver commented Mar 8, 2019

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 :)

@Lyrkan
Copy link
Contributor

Lyrkan commented Mar 8, 2019

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 webpack/webpack#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.

@kunicmarko20 kunicmarko20 merged commit 384af9f into FriendsOfSymfony:master Mar 9, 2019
@kunicmarko20
Copy link
Contributor

Thank @bobvandevijver! Thanks @Lyrkan for reviewing again!

@ktherage
Copy link
Contributor

@kunicmarko20 sorry I'm late 😅 I only seen your cc to me for review now

@kunicmarko20
Copy link
Contributor

np @ktherage, I guess change is fine?

@ktherage
Copy link
Contributor

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants