Skip to content

Commit

Permalink
fix(webpack): .mjs.cjs ファイルをバンドルに含める
Browse files Browse the repository at this point in the history
  • Loading branch information
chalkygames123 committed Mar 31, 2023
1 parent d0fac91 commit bed0d83
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ const isDevelopment = config.get('mode') !== 'production';
const ig = ignore().add(readFileSync('.gitignore', 'utf8'));
const crawler = new Fdir()
.withBasePath()
.filter((filePath) => !ig.ignores(filePath) && extname(filePath) === '.js')
.filter(
(filePath) =>
!ig.ignores(filePath) &&
['.js', '.mjs', '.cjs'].includes(extname(filePath)),
)
.crawl(posix.join(config.get('srcDir'), 'assets/scripts'));

/**
Expand Down Expand Up @@ -48,7 +52,7 @@ module.exports = {
module: {
rules: [
{
test: /\.js$/,
test: /\.(?:js|mjs|cjs)$/,
include: [
join(__dirname, config.get('srcDir'), 'assets/scripts'),
join(__dirname, config.get('srcDir'), 'modules'),
Expand Down

0 comments on commit bed0d83

Please sign in to comment.