Commit 8b1ea308 authored by Guy Bedford's avatar Guy Bedford Committed by Joe Haddad

webpack-dev-middleware, webpack-hot-middleware

parent 3621a5d5
...@@ -107,8 +107,6 @@ ...@@ -107,8 +107,6 @@
"use-subscription": "1.1.1", "use-subscription": "1.1.1",
"watchpack": "2.0.0-beta.13", "watchpack": "2.0.0-beta.13",
"webpack": "4.42.0", "webpack": "4.42.0",
"webpack-dev-middleware": "3.7.0",
"webpack-hot-middleware": "2.25.0",
"webpack-sources": "1.4.3" "webpack-sources": "1.4.3"
}, },
"peerDependencies": { "peerDependencies": {
...@@ -199,7 +197,9 @@ ...@@ -199,7 +197,9 @@
"text-table": "0.2.0", "text-table": "0.2.0",
"typescript": "3.7.3", "typescript": "3.7.3",
"unfetch": "4.1.0", "unfetch": "4.1.0",
"unistore": "3.4.1" "unistore": "3.4.1",
"webpack-dev-middleware": "3.7.0",
"webpack-hot-middleware": "2.25.0"
}, },
"engines": { "engines": {
"node": ">=10.13.0" "node": ">=10.13.0"
......
...@@ -3,8 +3,8 @@ import { IncomingMessage, ServerResponse } from 'http' ...@@ -3,8 +3,8 @@ import { IncomingMessage, ServerResponse } from 'http'
import { join, normalize, relative as relativePath, sep } from 'path' import { join, normalize, relative as relativePath, sep } from 'path'
import { UrlObject } from 'url' import { UrlObject } from 'url'
import webpack from 'webpack' import webpack from 'webpack'
import WebpackDevMiddleware from 'webpack-dev-middleware' import WebpackDevMiddleware from 'next/dist/compiled/webpack-dev-middleware'
import WebpackHotMiddleware from 'webpack-hot-middleware' import WebpackHotMiddleware from 'next/dist/compiled/webpack-hot-middleware'
import { createEntrypoints, createPagesMapping } from '../build/entries' import { createEntrypoints, createPagesMapping } from '../build/entries'
import { watchCompilers } from '../build/output' import { watchCompilers } from '../build/output'
import getBaseWebpackConfig from '../build/webpack-config' import getBaseWebpackConfig from '../build/webpack-config'
......
...@@ -6,8 +6,7 @@ module.exports = function(task) { ...@@ -6,8 +6,7 @@ module.exports = function(task) {
// eslint-disable-next-line require-yield // eslint-disable-next-line require-yield
task.plugin('ncc', {}, function*(file, options) { task.plugin('ncc', {}, function*(file, options) {
return ncc(join(__dirname, file.dir, file.base), { return ncc(join(__dirname, file.dir, file.base), {
// cannot bundle filename: file.base,
externals: ['chokidar'],
minify: true, minify: true,
...options, ...options,
}).then(({ code, assets }) => { }).then(({ code, assets }) => {
...@@ -20,7 +19,7 @@ module.exports = function(task) { ...@@ -20,7 +19,7 @@ module.exports = function(task) {
) )
if (options && options.packageName) { if (options && options.packageName) {
writePackageManifest.call(this, options.packageName) writePackageManifest.call(this, options.packageName, file.base)
} }
file.data = Buffer.from(code, 'utf8') file.data = Buffer.from(code, 'utf8')
...@@ -31,12 +30,9 @@ module.exports = function(task) { ...@@ -31,12 +30,9 @@ module.exports = function(task) {
// This function writes a minimal `package.json` file for a compiled package. // This function writes a minimal `package.json` file for a compiled package.
// It defines `name`, `main`, `author`, and `license`. It also defines `types`. // It defines `name`, `main`, `author`, and `license`. It also defines `types`.
// n.b. types intended for development usage only. // n.b. types intended for development usage only.
function writePackageManifest(packageName) { function writePackageManifest(packageName, main) {
const packagePath = require.resolve(packageName + '/package.json') const packagePath = require.resolve(packageName + '/package.json')
let { name, main, author, license } = require(packagePath) let { name, author, license } = require(packagePath)
if (!main) {
main = 'index.js'
}
const compiledPackagePath = join(__dirname, `dist/compiled/${packageName}`) const compiledPackagePath = join(__dirname, `dist/compiled/${packageName}`)
......
This diff is collapsed.
...@@ -196,11 +196,18 @@ declare module 'next/dist/compiled/text-table' { ...@@ -196,11 +196,18 @@ declare module 'next/dist/compiled/text-table' {
export = textTable export = textTable
} }
declare module 'next/dist/compiled/unistore' { declare module 'next/dist/compiled/unistore' {
import m from 'unistore' import m from 'unistore'
export = m export = m
} }
declare module 'next/dist/compiled/webpack-dev-middleware' {
import m from 'webpack-dev-middleware'
export = m
}
declare module 'next/dist/compiled/webpack-hot-middleware' {
import m from 'webpack-hot-middleware'
export = m
}
declare module 'autodll-webpack-plugin' { declare module 'autodll-webpack-plugin' {
import webpack from 'webpack' import webpack from 'webpack'
......
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