Skip to content

Commit

Permalink
fix: initialize worker options post browserlist setup
Browse files Browse the repository at this point in the history
Previously this cause browserlist data not to be passed to the worker.
  • Loading branch information
alan-agius4 committed May 6, 2021
1 parent a312558 commit ff90621
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib/styles/stylesheet-processor.ts
Expand Up @@ -29,14 +29,6 @@ export class StylesheetProcessor {
constructor(private readonly basePath: string, private readonly cssUrl?: CssUrl, private readonly styleIncludePaths?: string[]) { }

process(filePath: string) {
const workerOptions: WorkerOptions = {
filePath,
basePath: this.basePath,
cssUrl: this.cssUrl,
styleIncludePaths: this.styleIncludePaths,
browserslistData: this.browserslistData,
};

if (!this.worker) {
this.worker = new Worker(join(__dirname, './stylesheet-processor-worker.js'));
}
Expand All @@ -46,6 +38,14 @@ export class StylesheetProcessor {
this.browserslistData = browserslist(undefined, { path: this.basePath });
}

const workerOptions: WorkerOptions = {
filePath,
basePath: this.basePath,
cssUrl: this.cssUrl,
styleIncludePaths: this.styleIncludePaths,
browserslistData: this.browserslistData,
};

const ioChannel = new MessageChannel();

try {
Expand Down

0 comments on commit ff90621

Please sign in to comment.