diff --git a/.gitignore b/.gitignore index e82299521f6..c714a07ef4d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ coverage .cache dist lib +!test/**/node_modules diff --git a/test/integration/plugins/node_modules/parcel-plugin-test/TextAsset.js b/test/integration/plugins/node_modules/parcel-plugin-test/TextAsset.js new file mode 100644 index 00000000000..7d1a352b901 --- /dev/null +++ b/test/integration/plugins/node_modules/parcel-plugin-test/TextAsset.js @@ -0,0 +1,16 @@ +const {Asset} = require('../../../../../'); + +class TextAsset extends Asset { + constructor(name, pkg, options) { + super(name, pkg, options); + this.type = 'js'; + } + + generate() { + return { + js: 'module.exports=' + JSON.stringify(this.contents) + }; + } +} + +module.exports = TextAsset; diff --git a/test/integration/plugins/node_modules/parcel-plugin-test/index.js b/test/integration/plugins/node_modules/parcel-plugin-test/index.js new file mode 100644 index 00000000000..1878e88fb5c --- /dev/null +++ b/test/integration/plugins/node_modules/parcel-plugin-test/index.js @@ -0,0 +1,3 @@ +module.exports = function (bundler) { + bundler.addAssetType('txt', require.resolve('./TextAsset')); +};