Skip to content

Building my lambda using serverless-webpack throwing error 'Module '"../../../node_modules/nestjs-dataloader/dist"' has no exported member 'NestDataLoader'.' #38

@vijaych1209

Description

@vijaych1209

I am trying to build my serverless app using NestJS Dataloader. Attached is my webpack config file.
The issue I am facing is that my webpack is looking for NestDataLoader in the dist/index.js file which doesnt have NestDataLoader defined in it. its actually the part of index.ts in NestJS Dataloader distribution.

const path = require('path')
const slsw = require('serverless-webpack')
const isLocal = slsw.lib.webpack.isLocal
const nodeExternals = require('webpack-node-externals')
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');


module.exports = {
    mode: isLocal ? 'development' : 'production',
    devtool: isLocal ? 'source-map' : 'none',
    entry: slsw.lib.entries,
    target: 'node',
    resolve: {
        plugins: [new TsconfigPathsPlugin({ configFile: "./tsconfig.json" })],
        extensions: ['.mjs', '.ts', '.js']
    },
    output: {
        libraryTarget: 'commonjs2',
        path: path.join(__dirname, '.webpack'),
        filename: '[name].js'
    },
    externals: [nodeExternals()],
    module: {
        rules: [
            {
                test: /\.ts$/,
                exclude: /node_modules/,
                loader: 'ts-loader',
                options: { allowTsInNodeModules: true }
            }
        ]
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions