代码拉取完成,页面将自动刷新
同步操作将从 终端组/bricks 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const webpack = require('webpack');
const themeConfig = require('./themes.config.ts');
const devMode = process.env.NODE_ENV !== 'production'
const minimizer = [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: true // set to true if you want JS source maps
}),
new OptimizeCSSAssetsPlugin({})
];
const commonCssLoaders = [
MiniCssExtractPlugin.loader, // creates style nodes from JS strings or extra css
"css-loader", // translates CSS into CommonJS
"postcss-loader",
];
const themeCssEntry = () => {
let entryList = {};
for(let theme in themeConfig) {
entryList[theme] = `./src/styles/bricks_${theme}.scss`;
}
return entryList;
};
module.exports = {
mode: devMode ? 'development' : 'production',
devtool: devMode ? "inline-source-map" : 'hidden-source-map',
entry: {
bricks: "./src/index.ts",
...themeCssEntry()
},
output: {
path: __dirname + '/dist',
filename: devMode ? "[name].development.js" : '[name].production.js',
library: 'bricks',
libraryTarget: 'umd'
},
optimization: {
minimizer: devMode ? [] : minimizer,
sideEffects: false
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), // 忽略moment的语言包
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: devMode ? "[name].development.css" : "[name].production.css",
chunkFilename: "[id].css"
})
],
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"]
},
module: {
rules: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{
test: /\.tsx?$/,
use: [
"babel-loader",
"ts-loader"
]
},
{
test: /\.css/,
use: commonCssLoaders,
},
{
test: /\.scss$/,
use: [
...commonCssLoaders,
"sass-loader", // compiles Sass to CSS
]
},
{
test: /(\.(eot|ttf|woff|woff2)|font)$/,
loader: 'file-loader',
options: {
outputPath: 'fonts/'
}
},
{
test: /\.(png|jpg|gif|svg|jpeg)$/,
loader: 'file-loader',
options: {
outputPath: 'images/'
}
}
]
},
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom',
},
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。