1 Star 3 Fork 0

Anyon/ThinkAdminEditor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 3.40 KB
一键复制 编辑 原始数据 按行查看 历史
Anyon 提交于 2024-05-11 04:31 +08:00 . 增加 lineHeight
/**
* @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,
},
},
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zoujingli/think-admin-editor.git
git@gitee.com:zoujingli/think-admin-editor.git
zoujingli
think-admin-editor
ThinkAdminEditor
typescript

搜索帮助