diff --git a/src/rules/dynamic-import-chunkname.js b/src/rules/dynamic-import-chunkname.js index 44fb5611c..9b6168629 100644 --- a/src/rules/dynamic-import-chunkname.js +++ b/src/rules/dynamic-import-chunkname.js @@ -30,7 +30,7 @@ module.exports = { const { webpackChunknameFormat = '[0-9a-zA-Z-_/.]+' } = config || {} const paddedCommentRegex = /^ (\S[\s\S]+\S) $/ - const commentStyleRegex = /^( \w+: ("[^"]*"|\d+|false|true),?)+ $/ + const commentStyleRegex = /^( \w+: ("[^"]*"|\/.*\/|\d+|false|true),?)+ $/ const chunkSubstrFormat = ` webpackChunkName: "${webpackChunknameFormat}",? ` const chunkSubstrRegex = new RegExp(chunkSubstrFormat) diff --git a/tests/src/rules/dynamic-import-chunkname.js b/tests/src/rules/dynamic-import-chunkname.js index d19667c16..38521e367 100644 --- a/tests/src/rules/dynamic-import-chunkname.js +++ b/tests/src/rules/dynamic-import-chunkname.js @@ -32,6 +32,30 @@ ruleTester.run('dynamic-import-chunkname', rule, { )`, options, }, + { + code: `dynamicImport( + /* webpackInclude: /some-regex/ */ + /* webpackChunkName: "someModule" */ + 'test' + )`, + options, + }, + { + code: `dynamicImport( + /* webpackChunkName: "someModule" */ + /* webpackInclude: /some-regex/ */ + 'test' + )`, + options, + }, + { + code: `dynamicImport( + /* webpackExclude: /some-regex/ */ + /* webpackChunkName: "someModule" */ + 'test' + )`, + options, + }, { code: `dynamicImport( /* webpackChunkName: "Some_Other_Module" */