Skip to content

Commit

Permalink
fix: allowed extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
barelyhuman committed Aug 28, 2023
1 parent 74f10ce commit 65b77bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internals.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { generateIslands, getManifest } = require('./lib/plugin')
const { ALLOWED_EXTENSIONS } = require('./lib/constants')

exports.generateIslands = generateIslands
exports.getManifest = getManifest
exports.ALLOWED_EXTENSIONS = ALLOWED_EXTENSIONS
1 change: 1 addition & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exports.ALLOWED_EXTENSIONS = ['jsx', 'js', 'ts', 'tsx']
3 changes: 3 additions & 0 deletions rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ const { nodeResolve } = require('@rollup/plugin-node-resolve')
const jsx = require('acorn-jsx')
const { babel } = require('@rollup/plugin-babel')
const { resolveTsConfig } = require('./lib/typescript')
const path = require('path')
const { ALLOWED_EXTENSIONS } = require('./lib/constants')

exports = module.exports = rollupPlugin

Expand All @@ -30,6 +32,7 @@ function rollupPlugin(options = defaultOptions) {
return {
name: 'preact-island-plugin',
async transform(_, id) {
if (!ALLOWED_EXTENSIONS.includes(path.extname(id))) return
if (id.includes('virtual:')) return
// ignore files that don't exist
if (!existsSync(id)) return
Expand Down

0 comments on commit 65b77bf

Please sign in to comment.