diff --git a/snowpack/src/build/file-urls.ts b/snowpack/src/build/file-urls.ts index 827d88c939..eb699d91e5 100644 --- a/snowpack/src/build/file-urls.ts +++ b/snowpack/src/build/file-urls.ts @@ -2,27 +2,6 @@ import path from 'path'; import {MountEntry, SnowpackConfig} from '../types/snowpack'; import {getExt, replaceExt} from '../util'; -export const defaultFileExtensionMapping = { - '.mjs': '.js', - '.jsx': '.js', - '.ts': '.js', - '.tsx': '.js', - '.vue': '.js', - '.svelte': '.js', - '.mdx': '.js', - '.svx': '.js', - '.elm': '.js', - '.yaml': '.json', - '.toml': '.json', - '.php': '.html', - '.md': '.html', - '.ejs': '.html', - '.njk': '.html', - '.scss': '.css', - '.sass': '.css', - '.less': '.css', -}; - /** * Map a file path to the hosted URL for a given "mount" entry. */ @@ -44,7 +23,7 @@ export function getUrlForFileMount({ baseExt, mountEntry.static ? baseExt - : config._extensionMap[baseExt] || defaultFileExtensionMapping[baseExt] || baseExt, + : config._extensionMap[baseExt] || baseExt, ); } diff --git a/snowpack/src/build/import-resolver.ts b/snowpack/src/build/import-resolver.ts index 867952da0b..5a4031eb22 100644 --- a/snowpack/src/build/import-resolver.ts +++ b/snowpack/src/build/import-resolver.ts @@ -3,7 +3,7 @@ import path from 'path'; import url from 'url'; import {ImportMap, SnowpackConfig} from '../types/snowpack'; import {findMatchingAliasEntry, getExt, replaceExt} from '../util'; -import {defaultFileExtensionMapping, getUrlForFile} from './file-urls'; +import {getUrlForFile} from './file-urls'; const cwd = process.cwd(); @@ -32,7 +32,7 @@ function resolveSourceSpecifier(spec: string, stats: fs.Stats | false, config: S } // Transform the file extension (from input to output) const {baseExt} = getExt(spec); - const extToReplace = config._extensionMap[baseExt] || defaultFileExtensionMapping[baseExt]; + const extToReplace = config._extensionMap[baseExt]; if (extToReplace) { spec = replaceExt(spec, baseExt, extToReplace); } diff --git a/snowpack/src/config.ts b/snowpack/src/config.ts index dbf452c395..e5397eb010 100644 --- a/snowpack/src/config.ts +++ b/snowpack/src/config.ts @@ -9,7 +9,6 @@ import {validate, ValidatorResult} from 'jsonschema'; import os from 'os'; import path from 'path'; import yargs from 'yargs-parser'; -import {defaultFileExtensionMapping} from './build/file-urls'; import {logger} from './logger'; import {esbuildPlugin} from './plugins/plugin-esbuild'; import { @@ -267,9 +266,7 @@ function parseScript(script: string): {scriptType: string; input: string[]; outp } else if (cleanInput[0] === '.vue') { cleanOutput = ['.js', '.css']; } else if (cleanInput.length > 0) { - cleanOutput = Array.from( - new Set(cleanInput.map((ext) => defaultFileExtensionMapping[ext] || ext)), - ); + cleanOutput = [...cleanInput]; } return {