set arbitrary compile options when calling SSR register function

pull/1226/head
Rich Harris 7 years ago
parent b763714222
commit 9037e93934

@ -2,7 +2,7 @@ import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import { compile } from '../index.ts'; import { compile } from '../index.ts';
const compileOptions = {}; let compileOptions = {};
function capitalise(name) { function capitalise(name) {
return name[0].toUpperCase() + name.slice(1); return name[0].toUpperCase() + name.slice(1);
@ -17,7 +17,7 @@ export default function register(options) {
} }
// TODO make this the default and remove in v2 // TODO make this the default and remove in v2
if ('store' in options) compileOptions.store = options.store; if (options) compileOptions = options;
} }
function _deregister(extension) { function _deregister(extension) {

@ -110,10 +110,12 @@ describe("ssr", () => {
delete require.cache[resolved]; delete require.cache[resolved];
}); });
require("../../ssr/register")({ const compileOptions = Object.assign(config.compileOptions || {}, {
store: !!config.store store: !!config.store
}); });
require("../../ssr/register")(compileOptions);
try { try {
const component = require(`../runtime/samples/${dir}/main.html`); const component = require(`../runtime/samples/${dir}/main.html`);
const { html } = component.render(config.data, { const { html } = component.render(config.data, {

Loading…
Cancel
Save