在条目中使用 Webpack 插件输出。 AngularTemplateCacheWebpackPlugin

时间:2021-06-22 07:43:12

标签: angularjs webpack

我正在使用 AngularTemplateCacheWebpackPlugin 将 AngularJS 组件模板生成到 javascript 文件中。

我的问题是,我无法将插件的输出包含到我的 webpack 条目中。 我试过直接添加 is 作为条目,但也尝试将其导入到我的主条目中。 我的插件生成包含 webpack 中使用的模块的输出文件。 Webpack 在我的插件之前运行,所以它抱怨找不到所需的模块,因为它们尚未生成,因此不存在。 在 webpack 验证条目之前,我找不到任何可以运行插件的方法。

----更新:添加了 webpack 配置代码----

entry: {
    app: './src/index.ts'//,
    //templates: ['./dist/html-templates.js', './dist/modules-templates.js', './dist/scripts-templates.js'] does not work
},
output: {
    filename: "bundle-[contenthash].js",
    path: path.resolve(__dirname, "dist"),
},

new AngularTemplateCacheWebpackPlugin({
        source: 'Modules/**/*.html',
        outputFilename: 'modules-templates.js',
        module: 'modules-templates',
        standalone: true
    }),

0 个答案:

没有答案