Skip to content

Commit 6eec5e6

Browse files
authored
let the plugin can access to loader context info
swc-project#36 maybe this will be more flexible
1 parent 4697faf commit 6eec5e6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ function makeLoader() {
7474
programmaticOptions.sourceMaps = true;
7575
}
7676

77+
if (programmaticOptions.plugin) {
78+
const passInPlugin = programmaticOptions.plugin;
79+
programmaticOptions.plugin = (m) => {
80+
return passInPlugin(m, this);
81+
};
82+
}
83+
7784
try {
7885
if (sync) {
7986
const output = swc.transformSync(source, programmaticOptions);

0 commit comments

Comments
 (0)