rollup-plugin-serve
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -6,2 +6,4 @@ # Changelog | ||
## [Unreleased] | ||
### Added | ||
- Default `contentBase` to current project folder | ||
@@ -8,0 +10,0 @@ ## [0.1.0] - 2016-09-29 |
@@ -12,3 +12,3 @@ 'use strict'; | ||
function serve (options) { | ||
if ( options === void 0 ) options = {}; | ||
if ( options === void 0 ) options = { contentBase: '' }; | ||
@@ -26,3 +26,3 @@ if (Array.isArray(options) || typeof options === 'string') { | ||
// Remove querystring | ||
var urlPath = request.url.split('?')[0]; | ||
var urlPath = decodeURI(request.url.split('?')[0]); | ||
@@ -51,4 +51,3 @@ readFileFromContentBase(options.contentBase, urlPath, function (error, content, filePath) { | ||
} else if (options.historyApiFallback) { | ||
filePath = path.resolve(options.contentBase, 'index.html'); | ||
fs.readFile(filePath, function (error, content) { | ||
readFileFromContentBase(options.contentBase, '/index.html', function (error, content, filePath) { | ||
if (error) { | ||
@@ -55,0 +54,0 @@ notFound(response, filePath); |
@@ -8,3 +8,3 @@ import { readFile } from 'fs'; | ||
function serve (options) { | ||
if ( options === void 0 ) options = {}; | ||
if ( options === void 0 ) options = { contentBase: '' }; | ||
@@ -22,3 +22,3 @@ if (Array.isArray(options) || typeof options === 'string') { | ||
// Remove querystring | ||
var urlPath = request.url.split('?')[0]; | ||
var urlPath = decodeURI(request.url.split('?')[0]); | ||
@@ -47,4 +47,3 @@ readFileFromContentBase(options.contentBase, urlPath, function (error, content, filePath) { | ||
} else if (options.historyApiFallback) { | ||
filePath = resolve(options.contentBase, 'index.html'); | ||
readFile(filePath, function (error, content) { | ||
readFileFromContentBase(options.contentBase, '/index.html', function (error, content, filePath) { | ||
if (error) { | ||
@@ -51,0 +50,0 @@ notFound(response, filePath); |
{ | ||
"name": "rollup-plugin-serve", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Serve your rolled up bundle", | ||
@@ -35,10 +35,10 @@ "main": "dist/index.cjs.js", | ||
"dependencies": { | ||
"mime": "^1.3.4", | ||
"opener": "^1.4.2" | ||
"mime": "^1.3.6", | ||
"opener": "^1.4.3" | ||
}, | ||
"devDependencies": { | ||
"rollup": "^0.36.4", | ||
"rollup-plugin-buble": "^0.14.0", | ||
"rollup": "^0.43.0", | ||
"rollup-plugin-buble": "^0.15.0", | ||
"rollup-watch": "^2.5.0" | ||
} | ||
} |
12729
202
Updatedmime@^1.3.6
Updatedopener@^1.4.3