代码拉取完成,页面将自动刷新
/**
* @license Copyright (c) 2014-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
'use strict';
/* eslint-env node */
const path = require('path');
const webpack = require('webpack');
const {bundler, styles} = require('@ckeditor/ckeditor5-dev-utils');
const {CKEditorTranslationsPlugin} = require('@ckeditor/ckeditor5-dev-translations');
const TerserWebpackPlugin = require('terser-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
// 是否创建 Map 文件
const CreateSourceMap = false;
module.exports = {
devtool: 'source-map',
performance: {hints: false},
entry: path.resolve(__dirname, 'src', 'ckeditor.ts'),
output: {
// The name under which the editor will be exported.
library: 'ClassicEditor',
path: path.resolve(__dirname, 'build'),
filename: 'ckeditor.js',
libraryTarget: 'umd',
libraryExport: 'default'
},
optimization: {
minimizer: [
new TerserWebpackPlugin({
sourceMap: CreateSourceMap,
terserOptions: {
output: {
// Preserve CKEditor 5 license comments.
comments: /^!/
}
},
extractComments: false
})
]
},
plugins: [
// 复制前端样式
new CopyWebpackPlugin({
patterns: [
{from: path.join(__dirname, 'src', 'content.css'), to: path.join(__dirname, 'build')}
]
}),
// 分离样式文件
new MiniCssExtractPlugin({filename: 'ckeditor.css'}),
// 定入默认语言
new CKEditorTranslationsPlugin({language: 'zh-cn', additionalLanguages: 'all'}),
// 写入版本信息
new webpack.BannerPlugin({banner: bundler.getLicenseBanner(), raw: true}),
new webpack.BannerPlugin('For licensing, see https://gitee.com/zoujingli/think-admin-editor'),
],
resolve: {
extensions: ['.ts', '.js', '.json']
},
module: {
rules: [{
test: /\.svg$/,
use: ['raw-loader']
}, {
test: /\.ts$/,
use: 'ts-loader'
}, {
test: /\.css$/,
use: [
{loader: MiniCssExtractPlugin.loader},
{loader: 'css-loader', options: {sourceMap: CreateSourceMap}},
{
loader: 'postcss-loader',
options: {
postcssOptions: styles.getPostCssConfig({
minify: true,
themeImporter: {
themePath: require.resolve('@ckeditor/ckeditor5-theme-lark')
},
})
}
}
]
}]
},
devServer: {
static: {
directory: path.join(__dirname, '/'),
watch: true,
},
hot: false,
port: 9988,
compress: true,
watchFiles: ['./index.html'],
devMiddleware: {
index: true,
mimeTypes: {phtml: 'text/html'},
publicPath: '/',
writeToDisk: true,
serverSideRender: true,
},
},
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。