因此,我使用Laravel 5.4,并使用webpack在1个大js文件中编译多个.js文件。Webpack编译文件夹中的所有文件
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/*
从文件夹中获取所有文件。所以,当我在webpack自动发现它的文件夹中创建一个新的js文件并在运行命令时编译它。
有人知道如何做到这一点吗?
感谢您的帮助。
你可以分享你的整个'webpack.config.js'吗? –
@m_callens我改变了! – Nieck