-
-
Notifications
You must be signed in to change notification settings - Fork 200
Closed
Labels
Description
I upgraded a project which uses FOSCKEditorBundle to use Encore 1.0, and for the most part the upgrade went pretty smoothly. Except for one issue with copying files.
We have a config that matches the documentation for using the bundle and Encore, and the process fails out while copying the editor files from node_modules to public/build. It only affects the plugins directory in that list of configs (commenting that one config out allows the build to succeed, minus all those files), and it looks like it has to do with the fact the various plugins have image files.
(node:29135) UnhandledPromiseRejectionWarning: TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings. Got export default __webpack_public_path__ + "ckeditor/plugins/about/dialogs/hidpi/logo_ckeditor.png";
at SourceNode_add [as add] (<project>/node_modules/webpack/node_modules/source-map/lib/source-node.js:184:11)
at new SourceNode (<project>/node_modules/webpack/node_modules/source-map/lib/source-node.js:43:29)
at RawSource.node (<project>/node_modules/webpack/node_modules/webpack-sources/lib/RawSource.js:49:10)
at exports.getNode (<project>/node_modules/webpack/node_modules/webpack-sources/lib/helpers.js:54:17)
at ReplaceSource.node (<project>/node_modules/webpack/node_modules/webpack-sources/lib/ReplaceSource.js:125:16)
at <project>/node_modules/webpack/node_modules/webpack-sources/lib/ConcatSource.js:105:54
at Array.map (<anonymous>)
at ConcatSource.node (<project>/node_modules/webpack/node_modules/webpack-sources/lib/ConcatSource.js:104:19)
at exports.getSourceAndMap (<project>/node_modules/webpack/node_modules/webpack-sources/lib/helpers.js:20:27)
at ConcatSource.sourceAndMap (<project>/node_modules/webpack/node_modules/webpack-sources/lib/ConcatSource.js:95:10)
at CachedSource.sourceAndMap (<project>/node_modules/webpack/node_modules/webpack-sources/lib/CachedSource.js:158:35)
at <project>/node_modules/webpack/node_modules/webpack-sources/lib/ConcatSource.js:106:31
at Array.map (<anonymous>)
at ConcatSource.node (<project>/node_modules/webpack/node_modules/webpack-sources/lib/ConcatSource.js:104:19)
at exports.getSourceAndMap (<project>/node_modules/webpack/node_modules/webpack-sources/lib/helpers.js:20:27)
at ConcatSource.sourceAndMap (<project>/node_modules/webpack/node_modules/webpack-sources/lib/ConcatSource.js:95:10)Even stranger is our full copyFiles() config actually does explicitly copy over a few image files, and that does work OK.
const Encore = require('@symfony/webpack-encore');
Encore
.copyFiles([
{from: './node_modules/ckeditor4/', to: 'ckeditor/[path][name].[ext]', pattern: /\.(js|css)$/, includeSubdirectories: false},
{from: './node_modules/ckeditor4/adapters', to: 'ckeditor/adapters/[path][name].[ext]'},
{from: './node_modules/ckeditor4/lang', to: 'ckeditor/lang/[path][name].[ext]'},
{from: './node_modules/ckeditor4/plugins', to: 'ckeditor/plugins/[path][name].[ext]'},
{from: './node_modules/ckeditor4/skins', to: 'ckeditor/skins/[path][name].[ext]'},
{from: './node_modules/ckeditor4/vendor', to: 'ckeditor/vendor/[path][name].[ext]'},
{from: './assets/images', to: (!Encore.isProduction() ? 'images/[path][name].[ext]' : 'images/[path][name].[hash:8].[ext]'), pattern: /\.(svg)$/},
{from: './assets/images', to: (!Encore.isProduction() ? 'images/[path][name].[ext]' : 'images/[path][name].[hash:8].[ext]'), pattern: /loading\.gif$/},
])xaviermarchegay, Gemorroj, fabienCambournac and sovetskivkhramtsov