Skip to content

Commit 141cdcc

Browse files
committed
add scope hositing test
1 parent 6de2762 commit 141cdcc

File tree

4 files changed

+108
-120
lines changed

4 files changed

+108
-120
lines changed

test/fixtures/scope_hoisting/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import {something} from './util'
2+
3+
something()

test/fixtures/scope_hoisting/util.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function something () {
2+
return 'wow'
3+
}

test/plugins.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const test = require('ava')
22
const path = require('path')
33
const EventEmitter = require('events')
4+
const webpack = require('webpack')
45
const AfterPlugin = require('./fixtures/plugins/after_plugin')
56
const {compileFixture, fs} = require('./_helpers')
67

@@ -18,3 +19,15 @@ test('compiles a project with a custom plugin, plugins can change output path',
1819
t.truthy(res.stats.compilation.options.entry.test === 'bar')
1920
})
2021
})
22+
23+
test('works with scope hoisting', (t) => {
24+
return compileFixture(t, 'scope_hoisting', {
25+
entry: { main: './index.js' },
26+
plugins: [new webpack.optimize.ModuleConcatenationPlugin()]
27+
}).then(({res, publicPath}) => {
28+
return fs.readFile(path.join(publicPath, 'main.js'), 'utf8')
29+
.then((src) => {
30+
t.regex(src, /\/\/ CONCATENATED MODULE: \.\/util\.js/)
31+
})
32+
})
33+
})

0 commit comments

Comments
 (0)