|
|
@@ -84,6 +84,14 @@ module.exports = function snippetAdapter( data ) {
|
|
|
};
|
|
|
|
|
|
function getWebpackConfig( config ) {
|
|
|
+ // Stringify all definitions values. The `DefinePlugin` injects definition values as they are so we need to stringify them,
|
|
|
+ // so they will become real strings in the generated code. See https://webpack.js.org/plugins/define-plugin/ for more information.
|
|
|
+ const definitions = {};
|
|
|
+
|
|
|
+ for ( const definitionKey in config.definitions ) {
|
|
|
+ definitions[ definitionKey ] = JSON.stringify( config.definitions[ definitionKey ] );
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
mode: config.production ? 'production' : 'development',
|
|
|
|
|
|
@@ -119,7 +127,7 @@ function getWebpackConfig( config ) {
|
|
|
banner: bundler.getLicenseBanner(),
|
|
|
raw: true
|
|
|
} ),
|
|
|
- new webpack.DefinePlugin( config.definitions )
|
|
|
+ new webpack.DefinePlugin( definitions )
|
|
|
],
|
|
|
|
|
|
// Configure the paths so building CKEditor 5 snippets work even if the script
|