rsnext/packages/next/build/webpack/plugins/dll-import.ts
Tim Neutkens 6feca310d7
Revert ncc webpack (#7370)
* Revert "Add retrying to CircleCi and fixes for ncc'ed webpack (#7366)"

This reverts commit 5beb365d12.

* Revert "ncc Webpack build (#7301)"

This reverts commit bd8f3c625f.

# Conflicts:
#	packages/next/package.json
2019-05-17 13:25:46 +02:00

23 lines
763 B
TypeScript

import path from 'path'
export function importAutoDllPlugin({ distDir }: { distDir: string }) {
const autodllPaths = path.join(
path.dirname(require.resolve('autodll-webpack-plugin')),
'paths.js'
)
require(autodllPaths)
const autodllCachePath = path.resolve(
path.join(distDir, 'cache', 'autodll-webpack-plugin')
)
require.cache[autodllPaths] = Object.assign({}, require.cache[autodllPaths], {
exports: Object.assign({}, require.cache[autodllPaths].exports, {
cacheDir: autodllCachePath,
getManifestPath: (hash: string) => (bundleName: string) =>
path.resolve(autodllCachePath, hash, `${bundleName}.manifest.json`),
}),
})
const AutoDllPlugin = require('autodll-webpack-plugin')
return AutoDllPlugin
}