Skip to content
Merged
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
4 changes: 3 additions & 1 deletion src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import { SyncWaterfallHook } from 'tapable';
import type { Compiler, Module, Compilation, LoaderContext } from 'webpack';
// Note: This was the old delcaration. It appears to be Webpack v3 compat.
// const { RawSource } = (webpack as any).sources || require('webpack-sources');
import { RawSource } from 'webpack-sources';
import webpackSources from 'webpack-sources';

import type { EmitCountMap, InternalOptions } from './index.js';

import type { CompilationAsset, FileDescriptor } from './helpers.js';
import { generateManifest, reduceAssets, reduceChunk, transformFiles } from './helpers.js';

const { RawSource } = webpackSources;

interface BeforeRunHookArgs {
emitCountMap: EmitCountMap;
manifestFileName: string;
Expand Down
14 changes: 14 additions & 0 deletions test/integration/usage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { execSync } from 'node:child_process';

import test from '../helpers/ava-compat';

// make implicit dependency explicit:
import '../../src/index';

test.before(() => execSync('pnpm build'));

test('can be used as documented', (t) => {
const readmeCode = "import { WebpackManifestPlugin } from 'webpack-manifest-plugin'";

t.deepEqual(execSync(`node -e "${readmeCode}"`, { encoding: 'utf-8' }), '');
});
Loading