diff --git a/test/core.js b/test/core.js index 1eb2b6c..d52b968 100644 --- a/test/core.js +++ b/test/core.js @@ -296,3 +296,30 @@ test('errors when using \'only\' and \'exclude\' together', async t => { ] }), /You can't use 'exclude' and 'only' at the same time/); }); + +test('require files without extension', async t => { + await cleanDir(path.resolve(__dirname, './fixtures/output/require-file')); + + const stats = await runWebpack({ + context: path.resolve(__dirname, './fixtures/app'), + + output: { + publicPath: '', + path: path.resolve(__dirname, './fixtures/output/require-file') + }, + + entry: { + app: './require-file.js' + }, + + plugins: [ + new ModulesCdnWebpackPlugin() + ] + }); + + const files = stats.compilation.chunks.reduce((files, x) => files.concat(x.files), []); + + t.is(files.length, 1); + t.true(includes(files, 'app.js')); + t.false(includes(files, 'https://unpkg.com/react@15.6.1/dist/react.js')); +}); diff --git a/test/fixtures/app/require-file.js b/test/fixtures/app/require-file.js new file mode 100644 index 0000000..79a3fd2 --- /dev/null +++ b/test/fixtures/app/require-file.js @@ -0,0 +1 @@ +import React from 'react/react';