JS: install external package through webpack?

Viewed 20

I am working on a fully JS app and trying to use an external library ( https://github.com/soldair/node-qrcode ) . My current webpack.config.js is the following:

const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const inheritedConfig = require('@main/build-configs/src/webpack')


const isProd = process.env.NODE_ENV === 'production';
const currentRoot = path.join(process.cwd());

module.exports = {
    ...inheritedConfig,
    entry: { 'entry': './src/index' },
    plugins: [
        ...inheritedConfig.plugins,
        new HtmlWebpackPlugin({
            title: 'QR Code Generator',
            template: path.join(currentRoot, '../../packages/shared/html-templates/index.html')
        }),
        !isProd && new webpack.HotModuleReplacementPlugin()
    ].filter(Boolean)
};

Is there a way to add the package through my webpack config?

0 Answers
Related