Skip to content

Commit

Permalink
WIP: fix require file
Browse files Browse the repository at this point in the history
  • Loading branch information
mastilver committed Jul 6, 2017
1 parent 8bbab8b commit eba739b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/dist/react.js'));
});
1 change: 1 addition & 0 deletions test/fixtures/app/require-file.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import React from 'react/react';

0 comments on commit eba739b

Please sign in to comment.