webpack을 사용하여 CommonsChunkPlugin을 사용하여 vendor.js 및 main.js 파일을 생성하고 있습니다. 내 애플 리케이션이 vendor.js 파일에 들어가기 위해 사용하는 모든 node_modules를 원한다. 그러나 생성 된 vendor.js 및 main.js 파일에는 구문 오류가 있습니다. 사실 AWS 용 람다 함수를 작성하고 있습니다. 이것은 나의 webpack.config 파일입니다.webpack, CommonsChunkPlugin은 생성 된 파일에 대해 구문 오류를 제공합니다.
const webpack = require('webpack');
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
main: './src/app'
},
watch: false,
target: 'node',
module: {
rules: [{
test: /\.js?$/,
use: 'babel-loader'
}]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: module => module.context && module.context.indexOf('node_modules') !== -1
}),
new CopyWebpackPlugin([
'config/shoppingPathsSAM.yaml'
])
],
output: {
libraryTarget: 'commonjs',
path: path.join(__dirname, '../build'),
filename: '[name].js'
}
}
내 .babelrc 파일은 당신은 당신의 바벨 설정을 잘못 다음
{ "presets": [ [ "env" ] ] }
'node' 버전,'babel' 버전 및 기타 관련 세부 정보의 구문 오류 스 니펫을 게시하십시오. – dashmug
또한 구문 오류가 어디서 발생합니까? AWS Lambda 또는 현지에서? – dashmug