Я запускаю npm run dev
, и консоль выводит предупреждения ниже, вот моя базовая конфигурация webpack, я использовал 'babel-polyfill' в своей записи и исключаю каталог node_modules
в моей конфигурации babel-loader :
module.exports = {
entry: {
index: ['babel-polyfill', entry]
},
output: {
path: dist
},
resolve: {
extensions: ['.web.js', '.js', '.jsx', '.less', '.scss', '.css', '.json', '.png', '.jpg', '.jpeg'],
alias: {
'@': src,
'@utils': path.resolve(src, 'utils'),
'@common': path.resolve(src, 'common'),
}
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
include: src,
use: {
loader: 'babel-loader?cacheDirectory'
}
}, {
test: /\.(eot|woff|svg|ttf|woff2|gif|appcache)(\?|$)/,
exclude: /^node_modules$/,
loader: 'url-loader?name=fonts/[name].[ext]',
include: src
}, {
test: /\.(png|jpg)$/,
// exclude: /^node_modules$/,
loader: 'url-loader?limit=8192&name=images/[hash:8].[name].[ext]'
// include: [SRC_PATH]
}, { test: /\.(svg)$/i,
loader: 'svg-sprite-loader',
include: [
require.resolve('antd').replace(/warn\.js$/, '')
// path.resolve(__dirname, 'images/'),
]}
]
},
optimization: {
runtimeChunk: {
name: 'runtime'
},
splitChunks: {
chunks: 'all',
minSize: 30000,
maxSize: 200000,
minChunks: 1,
maxAsyncRequests: 5,
maxInitialRequests: 4,
automaticNameDelimiter: '_',
cacheGroups: {
libs_antd: {
name: 'libs_antd',
test: path.resolve(root, 'node_modules', 'antd'),
chunks: 'async',
priority: -8,
reuseExistingChunk: true
},
verdors: {
name: 'verdors',
test: path.resolve(root, 'node_modules'),
chunks: 'initial',
priority: -10
},
node_commons: {
name: 'node_commons',
test: path.resolve(root, 'node_modules'),
chunks: 'async',
minChunks: 2,
priority: -10,
reuseExistingChunk: true
}
}
},
usedExports: true
},
plugins
};
и предупреждающие сообщения:
WARNING in ./node_modules/_antd@3.23.4@antd/lib/locale/hu_HU.d.ts 1:8
Module parse failed: Unexpected token (1:8)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> declare const _default: {
| locale: string;
| Pagination: any;
@ ./node_modules/antd/lib/locale lazy ^\.\/.*$ namespace object ./hu_HU.d.ts
@ ./src/app/component/index.js
@ ./src/app/model/container.js
@ ./src/app/index.js
@ ./src/router.js
@ ./src/entry.js
@ multi babel-polyfill ./src/entry
Я думал, что коды в node_modules не должны быть проанализированы, я не знаю, почему появляются предупреждения? Любые идеи? Спасибо.