Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Make removal of the 'polyfills' option more obvious #1099

Merged
merged 1 commit into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/library/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ module.exports = (neutrino, opts = {}) => {
throw new Error('Missing required preset option "name". You must specify a library name when using this preset.');
}

if ('polyfills' in opts) {
throw new Error('The polyfills option has been removed, since polyfills are no longer included by default.');
}

const options = merge({
target: 'web',
libraryTarget: 'umd',
Expand Down
7 changes: 7 additions & 0 deletions packages/library/test/library_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ test('throws when missing library name', t => {
t.true(err.message.includes('You must specify a library name'));
});

test('throws when polyfills defined', async t => {
const api = new Neutrino();

const err = t.throws(() => api.use(mw(), { name: 'alpha', polyfills: {} }));
t.true(err.message.includes('The polyfills option has been removed'));
});

test('valid preset production', t => {
process.env.NODE_ENV = 'production';
const api = new Neutrino();
Expand Down
4 changes: 4 additions & 0 deletions packages/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const getOutputForEntry = entry => basename(
);

module.exports = (neutrino, opts = {}) => {
if ('polyfills' in opts) {
throw new Error('The polyfills option has been removed, since polyfills are no longer included by default.');
}

const pkg = neutrino.options.packageJson;
const sourceMap = (pkg && pkg.dependencies && pkg.dependencies['source-map-support']) ||
pkg && pkg.devDependencies && pkg.devDependencies['source-map-support'] ||
Expand Down
7 changes: 7 additions & 0 deletions packages/node/test/node_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,10 @@ test('valid preset development', t => {
const errors = validate(config);
t.is(errors.length, 0);
});

test('throws when polyfills defined', async t => {
const api = new Neutrino();

const err = t.throws(() => api.use(mw(), { polyfills: {} }));
t.true(err.message.includes('The polyfills option has been removed'));
});
4 changes: 4 additions & 0 deletions packages/web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ module.exports = (neutrino, opts = {}) => {
throw new Error('The minify.style option has been removed. To enable style minification use the @neutrinojs/style-minify preset.');
}

if ('polyfills' in options) {
throw new Error('The polyfills option has been removed, since polyfills are no longer included by default.');
}

if (typeof options.devtool === 'string' || typeof options.devtool === 'boolean') {
options.devtool = {
development: options.devtool,
Expand Down
7 changes: 7 additions & 0 deletions packages/web/test/web_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,10 @@ test('throws when minify.style defined', async t => {
const err = t.throws(() => api.use(mw(), { minify: { style: false } }));
t.true(err.message.includes('The minify.style option has been removed'));
});

test('throws when polyfills defined', async t => {
const api = new Neutrino();

const err = t.throws(() => api.use(mw(), { polyfills: {} }));
t.true(err.message.includes('The polyfills option has been removed'));
});