Skip to content

Commit

Permalink
refactor jsx loader file
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Jan 4, 2023
1 parent 5ea94ea commit 416a067
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/jsx-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import escodegen from 'escodegen';
import fs from 'fs';
import jsx from 'acorn-jsx';
import { parse, parseFragment, serialize } from 'parse5';
import path from 'path';
import { URL, pathToFileURL } from 'url';

const baseURL = pathToFileURL(`${process.cwd()}/`).href;
const baseURL = new URL(`file://${process.cwd()}/`);
const jsxRegex = /\.(jsx)$/;

// TODO same hack as definitions
Expand All @@ -25,7 +23,7 @@ function getParse(html) {
}

export function getParser(moduleURL) {
const isJSX = path.extname(moduleURL.pathname) === '.jsx';
const isJSX = moduleURL.pathname.split('.').pop() === 'jsx';

if (!isJSX) {
return;
Expand Down

0 comments on commit 416a067

Please sign in to comment.