Symfony 包可以有自己的 Webpack Encore 配置吗? [英] Can a Symfony bundle have its own Webpack Encore configuration?

查看:33
本文介绍了Symfony 包可以有自己的 Webpack Encore 配置吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了自己的 Symfony 包.

I write my own Symfony bundle.

我知道您可以从包中导入资源:

I know that you can import assets from a bundle:

.addEntry('isotop', './vendor.../js/isotop.js')

但是 - 当您想使用 tailwind-css 时,这会带来问题.对于 Tailwind,您必须配置 webpack.config.js:

But - this brings problems when you want to use tailwind-css. For Tailwind you have to configure the webpack.config.js:

  .enablePostCssLoader((options) => {
         options.config = {
          // directory where the postcss.config.js file is stored
                 path: './postcss.config.js'
         };
   })

如果 bundle 可以自己创建一个 Webpack Encore 配置,那就太好了.这有可能吗?

It would be nice when the bundle could create an Webpack Encore Configuration by itself. Is this possible somehow?

推荐答案

这甚至是不可能的,因为您拥有一组 npm 依赖项,而应用程序可能有自己的依赖项.您应该捆绑所有资产,以便不需要任何后期处理.

That’s not even remotely possible since you have you own set of npm dependencies while the app may have its own. You should bundle all the assets so any post processing is not required.

这篇关于Symfony 包可以有自己的 Webpack Encore 配置吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆