Skip to content

Commit

Permalink
chore: setup debug environment
Browse files Browse the repository at this point in the history
  • Loading branch information
elcarim5efil committed Mar 29, 2019
1 parent 0034c34 commit ba7dc0b
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 1 deletion.
19 changes: 19 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "brk",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run-script",
"brk"
],
"port": 9229
},
]
}
17 changes: 17 additions & 0 deletions example/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const path = require('path');
const requireContext = require('../src/index');

function resolve(...args) {
return path.resolve(__dirname, ...args);
}

module.exports = {
input: resolve('src/index.js'),
output: {
file: resolve('dist/bundle.js'),
format: 'iife'
},
plugins: [
requireContext()
]
};
13 changes: 13 additions & 0 deletions example/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const rollup = require('rollup');
const config = require('./rollup.config');

async function build() {
const bundle = await rollup.rollup(config);
const { output } = await bundle.generate(config.output);

output.forEach(chunk => {
console.log(chunk.code)
});
}

build();
5 changes: 5 additions & 0 deletions example/src/imports/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log('a');

export default {

}
5 changes: 5 additions & 0 deletions example/src/imports/b.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log('b');

export default {

}
5 changes: 5 additions & 0 deletions example/src/imports/sub/c.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log('c');

export default {

}
5 changes: 5 additions & 0 deletions example/src/imports/sub/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
console.log('subindex');

export default {

}
4 changes: 4 additions & 0 deletions example/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const n = require('./n');
require.context('./imports', true, /.js$/);

console.log('index');
1 change: 1 addition & 0 deletions example/src/n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('a');
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "rollup-plugin for webpack requrie-context",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"brk": "node --inspect-brk example/run.js",
"example": "rollup -c example/rollup.config.js"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit ba7dc0b

Please sign in to comment.