1 Star 0 Fork 4

JasonZeng/form-render

forked from Vincent/form-render 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 2.52 KB
一键复制 编辑 原始数据 按行查看 历史
fateriddle 提交于 2019-12-04 19:18 . fix: react version flexible
const { resolve } = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
module.exports = {
mode: 'development',
context: resolve(__dirname, 'demo'),
entry: './index.js',
output: {
filename: '[name].bundle.js',
path: resolve(__dirname, 'docs/demo'),
},
module: {
rules: [
{
test: /\.jsx?$/,
use: ['babel-loader'],
exclude: /node_modules/,
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
{
loader: 'less-loader',
options: {
javascriptEnabled: true,
},
},
],
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new MonacoWebpackPlugin({
languages: ['json'],
features: ['snippets', 'suggest'],
}),
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
new HtmlWebpackPlugin({
resources: {
js: [
'[email protected]/umd/react.development.js',
'[email protected]/umd/react-dom.development.js',
'[email protected]/prop-types.min.js',
'[email protected]/min/moment.min.js',
'@alifd/[email protected]/dist/next.min.js',
],
css: ['@alifd/[email protected]/dist/next.min.css'],
},
excludeChunks: ['main'],
template: resolve(__dirname, 'demo/index.html'),
}),
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: false,
extractComments: false,
uglifyOptions: {
compress: {
unused: true,
drop_debugger: true,
},
warnings: false,
output: {
comments: false,
},
},
}),
],
externals: {
react: 'var window.React',
'react-dom': 'var window.ReactDOM',
'prop-types': 'var (window.PropTypes || window.React.PropTypes)',
'@alifd/next': 'var window.Next',
},
watchOptions: {
ignored: /node_modules/,
},
devServer: {
contentBase: resolve(__dirname, 'docs/demo'),
publicPath: '/',
port: 9000,
host: '127.0.0.1',
watchContentBase: true,
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
'monaco-editor': 'monaco-editor/esm/vs/editor/editor.api',
},
},
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zenghongtu/form-render.git
[email protected]:zenghongtu/form-render.git
zenghongtu
form-render
form-render
master

搜索帮助