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

fix(node-resolve): modulePaths default is not set #1534

Merged
merged 3 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/node-resolve/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const defaults = {
extensions: ['.mjs', '.js', '.json', '.node'],
resolveOnly: [],
moduleDirectories: ['node_modules'],
modulePaths: [],
ignoreSideEffectsForRoot: false,
// TODO: set to false in next major release or remove
allowExportsFolderMapping: true
Expand Down
21 changes: 21 additions & 0 deletions packages/node-resolve/test/snapshots/test.mjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,27 @@ The actual snapshot is saved in `test.mjs.snap`.

Generated by [AVA](https://avajs.dev).

## has default config

> Snapshot 1

{
allowExportsFolderMapping: true,
dedupe: [],
extensions: [
'.mjs',
'.js',
'.json',
'.node',
],
ignoreSideEffectsForRoot: false,
moduleDirectories: [
'node_modules',
],
modulePaths: [],
resolveOnly: [],
}

## throws error if local id is not resolved

> Snapshot 1
Expand Down
Binary file modified packages/node-resolve/test/snapshots/test.mjs.snap
Binary file not shown.
6 changes: 5 additions & 1 deletion packages/node-resolve/test/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import commonjs from '@rollup/plugin-commonjs';
import test from 'ava';
import { rollup } from 'rollup';

import { nodeResolve } from 'current-package';
import { nodeResolve, DEFAULTS } from 'current-package';

import { evaluateBundle, getCode, getImports, testBundle } from '../../../util/test.js';

Expand All @@ -23,6 +23,10 @@ test('exposes plugin version', (t) => {
t.regex(plugin.version, /^\d+\.\d+\.\d+/);
});

test('has default config', (t) => {
t.snapshot(DEFAULTS);
});

test('finds a module with jsnext:main', async (t) => {
const bundle = await rollup({
input: 'jsnext.js',
Expand Down
Loading