Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem trying to use with webpack #11

Open
knolleary opened this issue Jun 10, 2021 · 2 comments · May be fixed by #12
Open

Problem trying to use with webpack #11

knolleary opened this issue Jun 10, 2021 · 2 comments · May be fixed by #12

Comments

@knolleary
Copy link

Hi,

I'm trying to use webpack to create a bundle that includes eslint4b to run in a WebWorker.

I have the following webpack.config.js:

{
    entry: path.resolve(__dirname, 'lib/rules/function-eslint/index.js'),
    output: {
        filename: 'nrlint-plugin-rules-function-eslint.js',
        path: path.resolve(__dirname, 'resources'),
        library: {
            name: ['nrlint','rules'],
            type: 'assign-properties'
        }
    },
    resolve: {
        fallback: {
            "assert": path.resolve(__dirname, 'lib/rules/function-eslint/empty.js'),
            "util":   false,
            "path":   false
        }
    },
    mode: 'production',
    target: ['webworker']
}

When I run webpack, I get multiple errors of the sort:

Module not found: Error: Can't resolve '@eslint/eslintrc/conf/environments' in '/Users/nol/code/node-red/nrlint/node_modules/eslint4b/dist'

This happens for:

  • @eslint/eslintrc/conf/environments'
  • @eslint/eslintrc/lib/shared/config-ops
  • @eslint/eslintrc/lib/shared/config-validator

I have found I need to have the full eslint installed as a dependency of my own module for the webpack to work. Is that expected?

@k-toumura
Copy link

Since ESLint v7.8.0, some features have been extracted to @eslint/eslintrc, so I think we need to register it in dependencies in package.json.

In scripts/build.js, package id extraction logic does not deal with scoped modules (modules starting with @). This may be why @eslint/eslintrc is not automatically registered in the dependencies.

@yfwz100
Copy link

yfwz100 commented Jul 27, 2021

Maybe a PR is needed?

@yfwz100 yfwz100 linked a pull request Jul 28, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants