因此,我使用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