仅对Webpack中的某些输出文件使用chunkhash

Dan*_*rth 3 javascript typescript webpack

我正在构建一个正在作为其他应用程序中的插件加载的应用程序。语法思考或对讲。
因此,我将有一个javascript文件(加载程序),客户需要在其应用程序中引用该文件。
该文件又添加了一个iFrame并加载了引用我的主捆绑包的index.html。

现在,我希望加载程序的文件名中不包含chunkhash,但捆绑软件中应包含chunkhash。

可能?如果是这样,怎么办?

我的webpack配置(从弹出create-react-app-typescript):

entry: {
    app: [require.resolve('./polyfills'), paths.appIndexJs],
    loader: "./src/integration/loader.ts"
},
output: {
    // The build folder.
    path: paths.appBuild,
    // Generated JS file names (with nested folders).
    // There will be one main bundle, and one file per asynchronous chunk.
    // We don't currently advertise code splitting but Webpack supports it.
    filename: '[name].[chunkhash:8].js',
    chunkFilename: '[name].[chunkhash:8].chunk.js',
    // We inferred the "public path" (such as / or /my-project) from homepage.
    publicPath: publicPath,
    // Point sourcemap entries to original disk location (format as URL on Windows)
    devtoolModuleFilenameTemplate: info =>
        path
            .relative(paths.appSrc, info.absoluteResourcePath)
            .replace(/\\/g, '/'),
},
Run Code Online (Sandbox Code Playgroud)

Ara*_* Ve 6

为什么不使用函数filename

...
output: {
    ...
    filename: (chunkData) => {
        return chunkData.chunk.name === 'loader'
            ? '[name].js'
            : '[name].[chunkhash:8].js';
    },
}
Run Code Online (Sandbox Code Playgroud)

参见https://webpack.js.org/configuration/output/#output-filename