Skip to content

[Regression v8 to v9] Example can't import itself anymore. moduleAliases/WebpackConfig.resolve.alias is broken => import or require() statements can be added only by editing a Markdown example file #1310

@kopax

Description

@kopax

Upgrade to v9

Following #1280 @sapegin we finally migrated our UI lib to work with the latest react-styleguidist v9.

Now our webpack.alias is broken. We use to have in our webpackConfig:

    resolve: {
      alias: {
        $PACKAGE_NAME: resolve(__dirname),
        [pkg.name]: resolve(__dirname),
      },
    },

I have tried to set moduleAliases:

const path = require('path')
module.exports = {
  moduleAliases: {
        $PACKAGE_NAME: resolve(__dirname),
        [pkg.name]: resolve(__dirname),
  }
}

But this was equivalent, see make-webpack-config.js#L119

This was an important feature for us, as it permitted us to use a variable for the name of the package in development, and also it permitted to show proper import of the same module. Very useful because people usually write documentation for the module itself.

Our import are all broken:

image

This happened in a file (note that $PACKAGE_NAME is a webpackConfig.resolve.alias['$PACKAGE_NAME'] = ${__dirname}/src for the current package), it used to work.

This is what we expect

image

This is what we have

image

Could you please tell us what change so now webpackConfig.resolve.alias doesn't permit to inject alias in the context of examples?

Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions