mirror of
https://github.com/strapi/strapi.git
synced 2025-07-29 03:50:26 +00:00
evaluate the webpack.config.ts file and compile the file when we build the typescript project example
This commit is contained in:
parent
06694ec71d
commit
26100eea01
@ -8,13 +8,18 @@ const fs = require('fs-extra');
|
||||
const getWebpackConfig = require('../webpack.config');
|
||||
|
||||
const getCustomWebpackConfig = (dir, config) => {
|
||||
const adminConfigPath = path.join(dir, 'src', 'admin', 'webpack.config.js');
|
||||
const adminConfigPathJS = path.join(dir, 'src', 'admin', 'webpack.config.js');
|
||||
const adminConfigPathTS = path.join(dir, 'src', 'admin', 'webpack.config.ts');
|
||||
|
||||
let webpackConfig = getWebpackConfig(config);
|
||||
|
||||
if (fs.existsSync(adminConfigPath)) {
|
||||
const webpackAdminConfig = require(path.resolve(adminConfigPath));
|
||||
|
||||
if (fs.existsSync(adminConfigPathJS) || fs.existsSync(adminConfigPathTS)) {
|
||||
let webpackAdminConfig;
|
||||
if (fs.existsSync(adminConfigPathJS)) {
|
||||
webpackAdminConfig = require(path.resolve(adminConfigPathJS));
|
||||
} else {
|
||||
webpackAdminConfig = require(path.resolve(adminConfigPathTS));
|
||||
}
|
||||
if (_.isFunction(webpackAdminConfig)) {
|
||||
// Expose the devServer configuration
|
||||
if (config.devServer) {
|
||||
|
@ -22,8 +22,6 @@ module.exports = () => ({
|
||||
'.cache/',
|
||||
'.tmp/',
|
||||
|
||||
// Do not include admin files in the server compilation
|
||||
'src/admin/',
|
||||
// Do not include test files
|
||||
'**/*.test.ts',
|
||||
// Do not include plugins in the server compilation
|
||||
|
Loading…
x
Reference in New Issue
Block a user