parent
b67779d1dd
commit
5e0cb796a6
2 changed files with 9 additions and 0 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -21,6 +21,8 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
node_version: 16
|
node_version: 16
|
||||||
|
- os: macos-latest
|
||||||
|
node_version: 16
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
env:
|
env:
|
||||||
LANG: en-us
|
LANG: en-us
|
||||||
|
|
|
@ -6,6 +6,7 @@ import type { AstroConfig } from '../@types/astro-core';
|
||||||
import esbuild from 'esbuild';
|
import esbuild from 'esbuild';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
import os from 'os';
|
||||||
import { transform } from '@astrojs/compiler';
|
import { transform } from '@astrojs/compiler';
|
||||||
import { decode } from 'sourcemap-codec';
|
import { decode } from 'sourcemap-codec';
|
||||||
import { AstroDevServer } from '../core/dev/index.js';
|
import { AstroDevServer } from '../core/dev/index.js';
|
||||||
|
@ -79,6 +80,12 @@ export default function astro({ config, devServer }: AstroPluginOptions): vite.P
|
||||||
return { code: result.code, map };
|
return { code: result.code, map };
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// macOS fix: remove null chars generated by compiler
|
||||||
|
if (os.platform() === 'darwin') {
|
||||||
|
tsResult.code = tsResult.code.replace(/\x00/g, '');
|
||||||
|
}
|
||||||
|
|
||||||
// Compile `.ts` to `.js`
|
// Compile `.ts` to `.js`
|
||||||
const { code, map } = await esbuild.transform(tsResult.code, { loader: 'ts', sourcemap: 'external', sourcefile: id });
|
const { code, map } = await esbuild.transform(tsResult.code, { loader: 'ts', sourcemap: 'external', sourcefile: id });
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue