代码拉取完成,页面将自动刷新
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var extractLess = new ExtractTextPlugin({
filename: "ane.css",
disable: false
});
var extractLayoutLess = new ExtractTextPlugin({
filename: "layout.css",
disable: false
});
module.exports = {
entry: {
ane: './index.ts',
layout: './components/ms-layout/index.ts'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
library: '[name]',
libraryTarget: 'umd'
},
externals: {
avalon2: {
root: 'avalon',
commonjs: 'avalon2',
commonjs2: 'avalon2',
amd: 'avalon2'
},
jquery: {
root: 'jQuery',
commonjs: 'jquery',
commonjs2: 'jquery',
amd: 'jquery'
},
'async-validator': {
root: 'Schema',
commonjs: 'async-validator',
commonjs2: 'async-validator',
amd: 'async-validator'
},
bootbox: {
root: 'bootbox',
commonjs: 'bootbox',
commonjs2: 'bootbox',
amd: 'bootbox'
},
'dom-align': {
root: 'domAlign',
commonjs: 'dom-align',
commonjs2: 'dom-align',
amd: 'dom-align'
},
moment: true,
noty: {
root: 'noty',
commonjs: 'noty',
commonjs2: 'noty',
amd: 'noty'
},
'up-loader': {
root: 'Uploader',
commonjs: 'up-loader',
commonjs2: 'up-loader',
amd: 'up-loader'
}
},
module: {
rules: [{
test: /\.ts$/,
include: [
path.resolve(__dirname, 'index.ts'),
path.resolve(__dirname, 'ane-util.ts'),
path.resolve(__dirname, 'components')
],
loader: 'ts-loader'
}, {
test: /\.less$/,
include: [
path.resolve(__dirname, 'styles'),
path.resolve(__dirname, 'components')
],
exclude: [
path.resolve(__dirname, 'components/ms-layout')
],
use: extractLess.extract({
use: [{
loader: 'css-loader'
}, {
loader: 'less-loader'
}]
})
}, {
test: /\.less$/,
include: [
path.resolve(__dirname, 'styles'),
path.resolve(__dirname, 'components/ms-layout')
],
use: extractLayoutLess.extract({
use: [{
loader: 'css-loader'
}, {
loader: 'less-loader'
}]
})
}, {
test: /\.css$/,
include: [
path.resolve(__dirname, 'components'),
path.resolve(__dirname, 'node_modules')
],
use: extractLess.extract({
use: [{
loader: 'css-loader'
}]
})
}, {
test: /\.html$/,
include: [
path.resolve(__dirname, 'components')
],
use: [
{
loader: 'raw-loader'
},
{
loader: 'string-replace-loader',
query: {
multiple: [
{ search: '\r', replace: '', flags: 'g' }
]
}
}
]
}, {
test: /\.(eot|otf|ttf|woff|woff2|svg|png|gif)\w*/,
include: [
path.resolve(__dirname, 'components'),
path.resolve(__dirname, 'node_modules')
],
loader: 'file-loader',
query: {
limit: 1,
name: '[name].[ext]'
}
}]
},
resolve: {
mainFields: ['browser', 'main'],
extensions: ['.js', '.ts', '.less']
},
plugins: [
extractLess,
extractLayoutLess,
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
})
]
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。