Skip to content

Commit

Permalink
Slightly change logic to see if this helps windows
Browse files Browse the repository at this point in the history
  • Loading branch information
lukastaegert committed Mar 16, 2020
1 parent 70ee9b9 commit 9acf722
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-windows.yml
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
node: ['12', '10']
node: ['13', '12', '10']

name: ${{ matrix.node }} (Windows)
steps:
Expand Down
3 changes: 2 additions & 1 deletion cli/run/loadConfigFile.ts
@@ -1,5 +1,6 @@
import color from 'colorette';
import * as path from 'path';
import { pathToFileURL } from 'url';
import * as rollup from '../../src/node-entry';
import { GenericConfigObject } from '../../src/utils/parseOptions';
import relativeId from '../../src/utils/relativeId';
Expand All @@ -22,7 +23,7 @@ export default async function loadConfigFile(
): Promise<GenericConfigObject[]> {
const extension = path.extname(fileName);
const configFileExport = await (extension === '.mjs' && supportsNativeESM()
? (await esmDynamicImport(fileName)).default
? (await esmDynamicImport(pathToFileURL(fileName).href)).default
: extension === '.cjs'
? getDefaultFromCjs(require(fileName))
: getDefaultFromTranspiledConfigFile(fileName, commandOptions.silent));
Expand Down
1 change: 1 addition & 0 deletions rollup.config.js
Expand Up @@ -88,6 +88,7 @@ export default command => {
'path',
'os',
'stream',
'url',
'util'
],
treeshake,
Expand Down
2 changes: 1 addition & 1 deletion test/cli/samples/config-cjs-dirname/_config.js
@@ -1,4 +1,4 @@
module.exports = {
description: 'does not transpile cjs configs and provides correct __dirname',
description: 'does not transpile cjs configs and provides correct __filename',
command: 'rollup -c'
};
4 changes: 3 additions & 1 deletion test/cli/samples/config-cjs-dirname/nested/plugin.js
Expand Up @@ -2,6 +2,8 @@ const path = require('path');

module.exports = () => ({
transform(code) {
return `console.log('${path.relative(process.cwd(), __filename)}');\n${code}`;
return `console.log('${path
.relative(process.cwd(), __filename)
.replace('\\', '/')}');\n${code}`;
}
});
4 changes: 3 additions & 1 deletion test/cli/samples/config-cjs-dirname/plugin.js
Expand Up @@ -2,6 +2,8 @@ const path = require('path');

module.exports = () => ({
transform(code) {
return `console.log('${path.relative(process.cwd(), __filename)}');\n${code}`;
return `console.log('${path
.relative(process.cwd(), __filename)
.replace('\\', '/')}');\n${code}`;
}
});
5 changes: 4 additions & 1 deletion test/cli/samples/config-mjs-plugins/nested/plugin.mjs
Expand Up @@ -3,6 +3,9 @@ import { fileURLToPath } from 'url';

export default () => ({
transform(code) {
return `console.log('${relative(process.cwd(), fileURLToPath(import.meta.url))}');\n${code}`;
return `console.log('${relative(process.cwd(), fileURLToPath(import.meta.url)).replace(
'\\',
'/'
)}');\n${code}`;
}
});
5 changes: 4 additions & 1 deletion test/cli/samples/config-mjs-plugins/plugin.mjs
Expand Up @@ -3,6 +3,9 @@ import { fileURLToPath } from 'url';

export default () => ({
transform(code) {
return `console.log('${relative(process.cwd(), fileURLToPath(import.meta.url))}');\n${code}`;
return `console.log('${relative(process.cwd(), fileURLToPath(import.meta.url)).replace(
'\\',
'/'
)}');\n${code}`;
}
});

0 comments on commit 9acf722

Please sign in to comment.