Browse Source

Pull request #1428: QFX-1451 feat: 开放less常量修改

Merge in VISUAL/fineui from ~FAY/fineui:master to master

* commit 'b666122128253742a3035d8fd84118341df143c3':
  revert
  Revert "Pull request #1427: 无JIRA任务 整理一下"
  Revert "无JIRA任务 更新图标"
  QFX-1451 feat: 开放less常量修改
  无JIRA任务 更新图标
es6
fay 4 years ago
parent
commit
a25389abb8
  1. 67
      webpack/webpack.common.js

67
webpack/webpack.common.js

@ -1,10 +1,23 @@
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const autoprefixer = require("autoprefixer"); const autoprefixer = require('autoprefixer');
const path = require("path"); const path = require('path');
const fs = require('fs');
const dirs = require("./dirs"); const dirs = require('./dirs');
const attachments = require("./attachments"); const attachments = require('./attachments');
let lessVariables = {};
if (process.env.LESS_CONFIG_PATH) {
const lessConfigPath = path.isAbsolute(process.env.LESS_CONFIG_PATH)
? process.env.LESS_CONFIG_PATH
: path.resolve(__dirname, '../', process.env.LESS_CONFIG_PATH);
lessVariables = fs.existsSync(lessConfigPath)
? require(lessConfigPath) || {}
: {};
}
module.exports = { module.exports = {
entry: { entry: {
@ -17,8 +30,8 @@ module.exports = {
underscore: '_', underscore: '_',
}, },
resolve: { resolve: {
mainFields: ["module", "main"], mainFields: ['module', 'main'],
extensions: [".js", ".ts"], extensions: ['.js', '.ts'],
}, },
module: { module: {
rules: [ rules: [
@ -26,17 +39,20 @@ module.exports = {
test: /\.(js|ts)$/, test: /\.(js|ts)$/,
include: [dirs.NODE_MODULES, dirs.PRIVATE, dirs.TYPESCRIPT], include: [dirs.NODE_MODULES, dirs.PRIVATE, dirs.TYPESCRIPT],
exclude: /node_modules(\/|\\)core-js/, exclude: /node_modules(\/|\\)core-js/,
use: [{ use: [
loader: "babel-loader", {
loader: 'babel-loader',
options: { options: {
configFile: dirs.IE8_BABEL_CONFIG, configFile: dirs.IE8_BABEL_CONFIG,
}, },
}, { },
loader: "source-map-loader", {
loader: 'source-map-loader',
options: { options: {
enforce: "pre", enforce: 'pre',
}, },
}], },
],
}, },
{ {
test: /\.js$/, test: /\.js$/,
@ -51,9 +67,9 @@ module.exports = {
], ],
use: [ use: [
{ {
loader: "source-map-loader", loader: 'source-map-loader',
options: { options: {
enforce: "pre", enforce: 'pre',
}, },
}, },
], ],
@ -63,44 +79,49 @@ module.exports = {
include: [path.resolve(__dirname, '../', attachments.lodash)], include: [path.resolve(__dirname, '../', attachments.lodash)],
use: [ use: [
{ {
loader: "script-loader", loader: 'script-loader',
}, },
], ],
}, },
{ {
test: path.resolve(__dirname, '../', attachments.fix), test: path.resolve(__dirname, '../', attachments.fix),
use: [{ use: [
{
loader: 'expose-loader', loader: 'expose-loader',
options: 'Fix', options: 'Fix',
}], },
],
}, },
{ {
test: path.resolve(__dirname, '../', attachments.fixIE), test: path.resolve(__dirname, '../', attachments.fixIE),
use: [{ use: [
{
loader: 'expose-loader', loader: 'expose-loader',
options: 'Fix', options: 'Fix',
}], },
],
}, },
{ {
test: /\.(css|less)$/, test: /\.(css|less)$/,
use: [ use: [
MiniCssExtractPlugin.loader, MiniCssExtractPlugin.loader,
{ {
loader: "css-loader", loader: 'css-loader',
options: { options: {
url: false, url: false,
}, },
}, },
{ {
loader: "postcss-loader", loader: 'postcss-loader',
options: { options: {
plugins: [autoprefixer], plugins: [autoprefixer],
}, },
}, },
{ {
loader: "less-loader", loader: 'less-loader',
options: { options: {
relativeUrls: false, relativeUrls: false,
modifyVars: lessVariables,
}, },
}, },
], ],

Loading…
Cancel
Save