Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add staticURL to config, allow CORS #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions bin/tessereact-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,21 @@ choosePorts(HOST, DEFAULT_PORT)
// Load proxy config
const proxySetting = require(paths.appPackageJson).proxy
const proxyConfig = prepareProxy(proxySetting, paths.appPublic)

// Serve webpack assets generated by the compiler over a web sever.
const serverConfig = createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
const serverConfig = Object.assign(
{},
createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
),
{
headers: {
'Access-Control-Allow-Origin': '*'
}
}
)

const devServer = new WebpackDevServer(compiler, serverConfig)
// Launch WebpackDevServer.
devServer.listen(webpackPort, HOST, err => {
Expand All @@ -98,7 +108,8 @@ choosePorts(HOST, DEFAULT_PORT)
const tessereactConfig = Object.assign({}, {
port: serverPort,
snapshotsPath: 'snapshots',
entryURL: url.resolve(urls.localUrlForBrowser, 'static/js/tessereact.js')
entryURL: url.resolve(urls.localUrlForBrowser, 'static/js/tessereact.js'),
staticURL: urls.localUrlForBrowser
}, userConfig)

tessereactServer(process.cwd(), tessereactConfig)
Expand Down
19 changes: 15 additions & 4 deletions bin/tessereact-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,21 @@ choosePorts(HOST, DEFAULT_PORT)
// Load proxy config
const proxySetting = require(paths.appPackageJson).proxy
const proxyConfig = prepareProxy(proxySetting, paths.appPublic)

// Serve webpack assets generated by the compiler over a web sever.
const serverConfig = createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
const serverConfig = Object.assign(
{},
createDevServerConfig(
proxyConfig,
urls.lanUrlForConfig
),
{
headers: {
'Access-Control-Allow-Origin': '*'
}
}
)

const devServer = new WebpackDevServer(compiler, serverConfig)
// Launch WebpackDevServer.
devServer.listen(webpackPort, HOST, err => {
Expand All @@ -103,7 +113,8 @@ choosePorts(HOST, DEFAULT_PORT)
const tessereactConfig = Object.assign({}, {
port: serverPort,
snapshotsPath: 'snapshots',
entryURL: url.resolve(urls.localUrlForBrowser, 'static/js/tessereact.js')
entryURL: url.resolve(urls.localUrlForBrowser, 'static/js/tessereact.js'),
staticURL: urls.localUrlForBrowser
}, userConfig)

tessereactServer(process.cwd(), tessereactConfig, () => {
Expand Down