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: remove file import prefix to please ncc #526

Merged
merged 3 commits into from
Nov 13, 2022
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: 0 additions & 1 deletion src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import meow from 'meow';
import chalk from 'chalk';
import {URL} from 'url';
import {Flags, getConfig} from './config.js';
import {Format, Logger, LogLevel} from './logger.js';
import {
Expand Down
7 changes: 5 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,13 @@ function getTypeOfConfig(configPath: string): ConfigExtensions {
}

async function importConfigFile(configPath: string): Promise<Flags> {
// Use a filthy hack to prevent ncc / webpack from trying to process
// the runtime dynamic import. This hurt me more than it disgusts
// whoever is reading the code.
const _import = new Function('p', 'return import(p)');
const config = (
await import(`file://${path.resolve(process.cwd(), configPath)}`)
await _import(`file://${path.resolve(process.cwd(), configPath)}`)
).default;

return config;
}

Expand Down