【发布时间】:2017-11-19 07:05:42
【问题描述】:
所以我使用 Laravel 5.4 并使用 webpack 在 1 个大 js 文件中编译多个 .js 文件。
const { mix } = require('laravel-mix');
// Compile all CSS file from the theme
mix.styles([
'resources/assets/theme/css/bootstrap.min.css',
'resources/assets/theme/css/main.css',
'resources/assets/theme/css/plugins.css',
'resources/assets/theme/css/themes.css',
'resources/assets/theme/css/themes/emerald.css',
'resources/assets/theme/css/font-awesome.min.css',
], 'public/css/theme.css');
// Compile all JS file from the theme
mix.scripts([
'resources/assets/theme/js/bootstrap.min.js',
'resources/assets/theme/js/app.js',
'resources/assets/theme/js/modernizr.js',
'resources/assets/theme/js/plugins.js',
], 'public/js/theme.js');
这是我的webpack.mix.js 来做它(css 相同)。但我想得到类似:resources/assets/theme/js/* 从文件夹中获取所有文件。所以当我在文件夹中新建一个js文件时,webpack会自动找到它,并在我运行命令时进行编译。
有人知道怎么做吗?
感谢您的帮助。
【问题讨论】:
-
你能分享你的整个
webpack.config.js吗? -
@m_callens 我已经改了!
标签: javascript webpack laravel-5.4