【发布时间】:2018-12-06 10:48:52
【问题描述】:
我正在构建一个作为插件加载到其他应用程序中的应用程序。以语法或对讲方式思考。
因此,我将有一个客户需要在其应用程序中引用的 javascript 文件(加载程序)。
该文件又添加了一个 iFrame 并加载了我的 index.html,它引用了我的主包。
现在,我想让加载器的文件名中没有 chunkhash,但 bundle 应该有 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, '/'),
},
【问题讨论】:
-
你能补充一点关于你的项目结构的信息吗?那真的很有帮助。
-
@AravindanVe 不确定您到底需要知道什么。你能澄清一下吗?
标签: javascript typescript webpack