Reputation: 21
I am having an issue when I am trying to use the aws-sdk v3.
I am confident it is because of the optional chaining used in this node module file.
ERROR in ./node_modules/@aws-sdk/signature-v4/dist-es/getCanonicalHeaders.js 10:30
Module parse failed: Unexpected token (10:30)
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
| const canonicalHeaderName = headerName.toLowerCase();
| if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS ||
> unsignableHeaders?.has(canonicalHeaderName) ||
| PROXY_HEADER_PATTERN.test(canonicalHeaderName) ||
| SEC_HEADER_PATTERN.test(canonicalHeaderName)) {
@ ./node_modules/@aws-sdk/signature-v4/dist-es/index.js 2:0-60 2:0-60
I am using Babel 7, Webpack 4, and Node 14.
I've added @babel/plugin-proposal-optional-chaining
to my babel.config
file below:
module.exports = function (api) {
api.cache(true);
const presets = ['@babel/preset-env', '@babel/preset-react'];
const plugins = [
['@babel/plugin-proposal-nullish-coalescing-operator'],
['@babel/plugin-proposal-optional-chaining'],
];
return {
presets,
plugins
};
};
I've even tried adding @babel/plugin-proposal-optional-chaining
to my webpack.config.js
file:
{
test: /\.(js|jsx|es)$/,
use: [
'thread-loader',
{
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-proposal-nullish-coalescing-operator',
'@babel/plugin-proposal-optional-chaining'
],
presets: ['@babel/preset-react', '@babel/preset-env']
}
}
],
exclude: '/node_modules/',
},
Upvotes: 2
Views: 844