bholloway/entry-generator-webpack-plugin

Not working with webpack 2.2.1

joeyfigaro opened this issue · 0 comments

Using webpack: 2.2.1 with the following config:

const path = require('path');
const EntryGeneratorWebpackPlugin = require('entry-generator-webpack-plugin');
const nodeExternals = require('webpack-node-externals');


const config = {
	entry: ['tests.js'],
	target: 'node',
	output: {
		path: './_dist',
		filename: 'tests.js'
	},
	context: path.resolve(__dirname, '__test__'),
	externals: [nodeExternals()],
	module: {
		rules: [{
			test: /\.js$/,
			use: 'babel-loader'
		}]
	},
	plugins: [
		new EntryGeneratorWebpackPlugin('tests.js', [
			EntryGeneratorWebpackPlugin.globSource('**/*.spec.js', {})
		])
	]
};

module.exports = config;

It writes tests.js to the output path, but there's only some webpack boilerplate and an error inside of it. The error says it can't find tests.js (the entry.)

Full error:

Module not found: Error: Can't resolve 'tests.js' in '/Users/supersandwich/projects/project-in-react/__test__'

Contents of the test directory

- __test__
    - /actions
    - /fixtures
        - premium.spec.js
    - /reducers
    - /selectors
    - /utils
    - tests.js

Any ideas?