You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

const CopyWebpackPlugin = require("copy-webpack-plugin");
const path = require("path");
const pxtovw = require('postcss-px-to-viewport');
// const px2rem = require("postcss-px2rem");
// 配置基本大小
// const postcss = px2rem({
// // 基准大小 baseSize需要和rem.js中相同
// remUnit: 16,
// });
module.exports = {
publicPath: "/",
configureWebpack: {
plugins: [
new CopyWebpackPlugin([
{
from: "node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml",
},
{
from: "node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf",
},
{
from: "node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js",
to: "js/",
},
]),
],
resolve: {
alias: {
"@": path.join(__dirname, "src"),
},
},
},
lintOnSave: true,
css: {
loaderOptions: {
sass: {
//给sass-loader传递选项
},
css: {
//给css-loader传递选项
},
postcss: {
//给postcss-loader传递选项
plugins: [
new pxtovw({
unitToConvert: "px", //需要转换的单位,默认为"px"
viewportWidth: 1920, //设计稿的视口宽度
unitPrecision: 5, //单位转换后保留的小数位数
propList: ["*"], //要进行转换的属性列表,*表示匹配所有,!表示不转换
viewportUnit: "vw", //转换后的视口单位
fontViewportUnit: "vw", //转换后字体使用的视口单位
selectorBlackList: [], //不进行转换的css选择器继续使用原有单位
minPixelValue: 1, //设置最小的转换数值
mediaQuery: false, //设置媒体查询里的单位是否需要转换单位
replace: true, //是否直接更换属性值,而不添加备用属性
exclude: [/node_modules/], //忽略某些文件夹下的文件
}),
],
},
},
},
};