|
|
@@ -1,6 +1,4 @@
|
|
|
import type { UserConfigExport } from "@tarojs/cli"
|
|
|
-import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
|
-import iframeCommunicationWebpackPlugin from 'webpack-plugin-iframe-communicator';
|
|
|
|
|
|
export default {
|
|
|
logger: {
|
|
|
@@ -20,15 +18,14 @@ export default {
|
|
|
},
|
|
|
open: false
|
|
|
},
|
|
|
- webpack:{
|
|
|
- plugins: [
|
|
|
- new HtmlWebpackPlugin({
|
|
|
- template: './src/index.html',
|
|
|
- }),
|
|
|
- iframeCommunicationWebpackPlugin({
|
|
|
- hostOrigin: '*' // Trusted host origin
|
|
|
- }),
|
|
|
- ],
|
|
|
- },
|
|
|
+ webpackChain(chain, webpack) {
|
|
|
+ // 确保在 HtmlWebpackPlugin 之后添加
|
|
|
+ chain
|
|
|
+ .plugin('iframeCommunicationPlugin')
|
|
|
+ .use(require('webpack-plugin-iframe-communicator').default, [{
|
|
|
+ hostOrigin: '*',
|
|
|
+ }])
|
|
|
+ .after('htmlWebpackPlugin'); // 指定在 htmlWebpackPlugin 之后执行
|
|
|
+ }
|
|
|
}
|
|
|
} satisfies UserConfigExport<'webpack5'>
|