Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Webpack/Laravel mix将CKEditor传输到ES5_Laravel_Webpack_Ckeditor - Fatal编程技术网

使用Webpack/Laravel mix将CKEditor传输到ES5

使用Webpack/Laravel mix将CKEditor传输到ES5,laravel,webpack,ckeditor,Laravel,Webpack,Ckeditor,CKEditor在iOS 10(Safari)中不工作 我找到了一个指南,它描述了如何将它传输到ES5,ES5应该可以让它工作。我试着和拉威尔合作。指南如下: 我尝试使用Laravel Mix使其工作,但这不是我最强的技能,尽管我已经尝试过。根据Laravels doc,问题可以通过以下方式解决: mix.webpackConfig({ resolve: { module: { rules: [ {

CKEditor在iOS 10(Safari)中不工作

我找到了一个指南,它描述了如何将它传输到ES5,ES5应该可以让它工作。我试着和拉威尔合作。指南如下:

我尝试使用Laravel Mix使其工作,但这不是我最强的技能,尽管我已经尝试过。根据Laravels doc,问题可以通过以下方式解决:

mix.webpackConfig({
    resolve: {
        module: {
                rules: [
                {
                     test: /ckeditor5-[^\/\\]+[\/\\].*\.js$/,
                     use: [
                             {
                                 loader: 'babel-loader',
                                 options: {
                                   presets: [ require( '@babel/preset-env' ) ]
                                 }
                             }
                          ]
                },
               ]
            }
      }
});
但是我不能让它工作。 我还考虑过复制webpack.config.js,如下所述:

但是,当我试图解决这个问题时,我再次感到怀疑(这与语法最相关)。有没有人尝试过让CKEditor使用Laravel在Safari iOS 10中工作


提前,谢谢。

我知道你很久以前就问过这个问题,但今天我遇到了同样的问题

在你的webpack.mix.js中,我用一个小技巧解决了以下文档的问题

const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' );
const CKEStyles = require('@ckeditor/ckeditor5-dev-utils').styles;
const CKERegex = {
    svg: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
    css: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
};


Mix.listen('configReady', webpackConfig => {
const rules = webpackConfig.module.rules;
const targetSVG = /(\.(png|jpe?g|gif|webp)$|^((?!font).)*\.svg$)/;
const targetFont = /(\.(woff2?|ttf|eot|otf)$|font.*\.svg$)/;
const targetCSS = /\.css$/;

// exclude CKE regex from mix's default rules
for (let rule of rules) {
    if (rule.test.toString() === targetSVG.toString()) {
        rule.exclude = CKERegex.svg;
    }
    else if (rule.test.toString() === targetFont.toString()) {
        rule.exclude = CKERegex.svg;
    }
    else if (rule.test.toString() === targetCSS.toString()) {
        rule.exclude = CKERegex.css;
    }
}
});
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.webpackConfig({
    plugins: [
      new CKEditorWebpackPlugin({
        language: 'it'
      })
   ],
   module: {
    rules: [
        {
            test: /ckeditor5-[^\/\\]+[\/\\].+\.js$/,
            use: [
                {
                    loader: 'babel-loader',
                    options: Config.babel()
                }
            ]
        },
        {
            test: CKERegex.svg,
            use: [ 'raw-loader' ]
        },
        {
            test: CKERegex.css,
            use: [
                {
                    loader: 'style-loader',
                    options: {
                        singleton: true
                    }
                },
                {
                    loader: 'postcss-loader',
                    options: CKEStyles.getPostCssConfig({
                        themeImporter: {
                            themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
                        },
                        minify: true
                    })
                },
            ]
        }
    ]
}
});

确保按照文档安装正确的软件包

我知道你很久以前就提出了这个问题,但我今天也遇到了同样的问题

在你的webpack.mix.js中,我用一个小技巧解决了以下文档的问题

const CKEditorWebpackPlugin = require( '@ckeditor/ckeditor5-dev-webpack-plugin' );
const CKEStyles = require('@ckeditor/ckeditor5-dev-utils').styles;
const CKERegex = {
    svg: /ckeditor5-[^/\\]+[/\\]theme[/\\]icons[/\\][^/\\]+\.svg$/,
    css: /ckeditor5-[^/\\]+[/\\]theme[/\\].+\.css/,
};


Mix.listen('configReady', webpackConfig => {
const rules = webpackConfig.module.rules;
const targetSVG = /(\.(png|jpe?g|gif|webp)$|^((?!font).)*\.svg$)/;
const targetFont = /(\.(woff2?|ttf|eot|otf)$|font.*\.svg$)/;
const targetCSS = /\.css$/;

// exclude CKE regex from mix's default rules
for (let rule of rules) {
    if (rule.test.toString() === targetSVG.toString()) {
        rule.exclude = CKERegex.svg;
    }
    else if (rule.test.toString() === targetFont.toString()) {
        rule.exclude = CKERegex.svg;
    }
    else if (rule.test.toString() === targetCSS.toString()) {
        rule.exclude = CKERegex.css;
    }
}
});
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.webpackConfig({
    plugins: [
      new CKEditorWebpackPlugin({
        language: 'it'
      })
   ],
   module: {
    rules: [
        {
            test: /ckeditor5-[^\/\\]+[\/\\].+\.js$/,
            use: [
                {
                    loader: 'babel-loader',
                    options: Config.babel()
                }
            ]
        },
        {
            test: CKERegex.svg,
            use: [ 'raw-loader' ]
        },
        {
            test: CKERegex.css,
            use: [
                {
                    loader: 'style-loader',
                    options: {
                        singleton: true
                    }
                },
                {
                    loader: 'postcss-loader',
                    options: CKEStyles.getPostCssConfig({
                        themeImporter: {
                            themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
                        },
                        minify: true
                    })
                },
            ]
        }
    ]
}
});
确保按照文档安装正确的软件包