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

Support for wasm #5316

Merged
merged 10 commits into from
Oct 2, 2018
3 changes: 3 additions & 0 deletions packages/next-server/server/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ function getDynamicImportBundles (manifest, moduleIds) {

const logger = console

// since send doesn't support wasm yet
send.mime.define({ 'application/wasm': ['wasm'] })

export async function render (req, res, pathname, query, opts) {
const html = await renderToHTML(req, res, pathname, query, opts)
sendHTML(req, res, html, req.method, opts)
Expand Down
3 changes: 2 additions & 1 deletion packages/next/build/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ export default async function getBaseWebpackConfig (dir: string, {dev = false, i
hotUpdateMainFilename: 'static/webpack/[hash].hot-update.json',
// This saves chunks with the name given via `import()`
chunkFilename: isServer ? `${dev ? '[name]' : '[name].[contenthash]'}.js` : `static/chunks/${dev ? '[name]' : '[name].[contenthash]'}.js`,
strictModuleExceptionHandling: true
strictModuleExceptionHandling: true,
webassemblyModuleFilename: 'static/wasm/[modulehash].wasm'
},
performance: { hints: false },
resolve: resolveConfig,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/export/pages/dynamic-imports.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Link from 'next/link'
import dynamic from 'next/dynamic'

const DynamicComponent = dynamic(import('../components/hello'))
const DynamicComponent = dynamic(() => import('../components/hello'))

export default () => (
<div id='dynamic-imports-page'>
Expand Down