Commit b041fa47 authored by Andy's avatar Andy Committed by Tim Neutkens

Support for wasm (#5316)

* Set a default path for wasm modules

* Added the mimetype "application/wasm" for wasm files

* Upgrade write-file-webpack-plugin to 4.4.1

* Made dynamic(import()) in test to dynamic(() => import())
parent e994159e
......@@ -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)
......
......@@ -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,
......
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'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment