Comparing version 0.16.11 to 0.16.12
@@ -0,1 +1,16 @@ | ||
## [0.16.12](https://github.com/vuejs/vite/compare/v0.16.11...v0.16.12) (2020-05-25) | ||
### Bug Fixes | ||
* fix rewrite extension appending for out of root files ([84fcfb6](https://github.com/vuejs/vite/commit/84fcfb66ecd9822ebb9dd56505332acce20da568)) | ||
* use upward search for env files ([4fceaea](https://github.com/vuejs/vite/commit/4fceaea1b60ba71f954796dfc601e91300344d3f)) | ||
### Features | ||
* support webp as static assets ([5589fa3](https://github.com/vuejs/vite/commit/5589fa3ea51f5442083eb4a31844e23386c89af4)) | ||
## [0.16.11](https://github.com/vuejs/vite/compare/v0.16.10...v0.16.11) (2020-05-25) | ||
@@ -2,0 +17,0 @@ |
@@ -11,2 +11,3 @@ "use strict"; | ||
const buildPluginEsbuild_1 = require("./build/buildPluginEsbuild"); | ||
const utils_1 = require("./utils"); | ||
const debug = require('debug')('vite:config'); | ||
@@ -78,3 +79,3 @@ async function resolveConfig(mode, configPath) { | ||
// load environment variables | ||
const env = loadEnv(mode, cwd); | ||
const env = loadEnv(mode, config.root || cwd); | ||
debug(`env: %O`, env); | ||
@@ -135,17 +136,17 @@ config.env = env; | ||
} | ||
function loadEnv(mode, cwd) { | ||
function loadEnv(mode, root) { | ||
debug(`env mode: ${mode}`); | ||
const { resolve } = path_1.default; | ||
const envFiles = [ | ||
/** default file */ resolve(cwd, '.env'), | ||
/** local file */ resolve(cwd, `.env.local`), | ||
/** mode file */ resolve(cwd, `.env.${mode}`), | ||
/** mode local file */ resolve(cwd, `.env.${mode}.local`) | ||
/** default file */ `.env`, | ||
/** local file */ `.env.local`, | ||
/** mode file */ `.env.${mode}`, | ||
/** mode local file */ `.env.${mode}.local` | ||
]; | ||
const env = {}; | ||
for (const file of envFiles) { | ||
if (fs_extra_1.default.existsSync(file) && fs_extra_1.default.statSync(file).isFile()) { | ||
const path = utils_1.lookupFile(root, [file], true); | ||
if (path) { | ||
const result = dotenv_1.default.config({ | ||
debug: !!process.env.DEBUG, | ||
path: file | ||
path | ||
}); | ||
@@ -152,0 +153,0 @@ if (result.error) { |
@@ -162,2 +162,4 @@ "use strict"; | ||
const bareImportRE = /^[^\/\.]/; | ||
const indexRE = /\/index\.\w+$/; | ||
const indexRemoveRE = /\/index(\.\w+)?$/; | ||
exports.resolveImport = (root, importer, id, resolver, timestamp) => { | ||
@@ -180,4 +182,13 @@ id = resolver.alias(id) || id; | ||
// 3. resolve extensions. | ||
const file = resolver.requestToFile(pathname); | ||
pathname = '/' + slash_1.default(path_1.default.relative(root, file)); | ||
const file = slash_1.default(resolver.requestToFile(pathname)); | ||
const resolvedExt = path_1.default.extname(file); | ||
if (resolvedExt !== path_1.default.extname(pathname)) { | ||
const indexMatch = file.match(indexRE); | ||
if (indexMatch) { | ||
pathname = pathname.replace(indexRemoveRE, '') + indexMatch[0]; | ||
} | ||
else { | ||
pathname += resolvedExt; | ||
} | ||
} | ||
// 4. mark non-src imports | ||
@@ -184,0 +195,0 @@ const ext = path_1.default.extname(pathname); |
@@ -80,3 +80,3 @@ "use strict"; | ||
const fullPath = path_1.default.join(dir, format); | ||
if (fs_extra_1.default.existsSync(fullPath)) { | ||
if (fs_extra_1.default.existsSync(fullPath) && fs_extra_1.default.statSync(fullPath).isFile()) { | ||
return pathOnly ? fullPath : fs_extra_1.default.readFileSync(fullPath, 'utf-8'); | ||
@@ -83,0 +83,0 @@ } |
@@ -39,3 +39,3 @@ "use strict"; | ||
exports.isExternalUrl = (url) => externalRE.test(url); | ||
const imageRE = /\.(png|jpe?g|gif|svg|ico)(\?.*)?$/; | ||
const imageRE = /\.(png|jpe?g|gif|svg|ico|webp)(\?.*)?$/; | ||
const mediaRE = /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/; | ||
@@ -42,0 +42,0 @@ const fontsRE = /\.(woff2?|eot|ttf|otf)(\?.*)?$/i; |
{ | ||
"name": "vite", | ||
"version": "0.16.11", | ||
"version": "0.16.12", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Evan You", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252379
4710