webpack这些年遇到的报错
1.
这个问题是因为webpack版本不同导致的写法谬误
批改前代码:

options: {              modules: true, // 以前的版本设置modules为true,而后其余属性和modules同级              getLocalIdent: (context, localIdentName, localName) => {                if (                  context.resourcePath.includes('node_modules') ||                  context.resourcePath.includes('ant.design.pro.less') ||                  context.resourcePath.includes('global.less')                ) {                  return localName;                }                const match = context.resourcePath.match(/src(.*)/);                if (match && match[1]) {                  const antdProPath = match[1].replace('.less', '');                  const arr = slash(antdProPath)                    .split('/')                    .map(a => a.replace(/([A-Z])/g, '-$1'))                    .map(a => a.toLowerCase());                  return `antd-pro${arr.join('-')}-${localName}`.replace(                    /--/g,                    '-',                  );                }                return localName;              },            },

批改后代码:

modules: {// 属性都写在modules外面                getLocalIdent: (context, localIdentName, localName) => {                  if (                    context.resourcePath.includes('pages') ||                    context.resourcePath.includes('node_modules') ||                    context.resourcePath.includes('ant.design.pro.less') ||                    context.resourcePath.includes('global.less')                  ) {                    return localName;                  }                  const match = context.resourcePath.match(/src(.*)/);                  if (match && match[1]) {                    const antdProPath = match[1].replace('.less', '');                    const arr = slash(antdProPath)                      .split('/')                      .map(a => a.replace(/([A-Z])/g, '-$1'))                      .map(a => a.toLowerCase());                    return `antd-pro${arr.join('-')}-${localName}`.replace(                      /--/g,                      '-',                    );                  }                  return localName;                },              },