@sdinteractive/requirejs-resolver

2.0.0 • Public • Published

requirejs-resolver

Allows using import to find modules based on requirejs config path mapping.

This is specifically useful for Magento 2, which extensively uses requirejs.

Config parsing

The config file is executed to find all calls to require.config().

Usage

In webpack.config.js:

const RequireJsResolverPlugin = require('@sdinteractive/requirejs-resolver');

module.exports = {
  resolve: {
    plugins: [
      new RequireJsResolverPlugin({
        configPath: path.resolve(__dirname, 'requirejs-config.js'),
      }),
    ],
  },
};

Normally for Magento 2, this should be the requirejs-config.js (or requirejs-config.min.js) generated by the static content process. This will map aliases in the requirejs-config when imported.

Readme

Keywords

Package Sidebar

Install

npm i @sdinteractive/requirejs-resolver

Weekly Downloads

214

Version

2.0.0

License

ISC

Unpacked Size

3.91 kB

Total Files

3

Last publish

Collaborators

  • mpchadwick
  • brianlabelle_rp
  • dborishansky
  • toddbc