-
-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added
build
command (aliases - 'bundle' and 'b')
- Loading branch information
1 parent
87b51c3
commit 7590f66
Showing
13 changed files
with
131 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const isInProcess = process.env.WEBPACK_BUNDLE; | ||
|
||
class CustomTestPlugin { | ||
constructor(isInEnvironment) { | ||
this.isInEnvironment = isInEnvironment; | ||
} | ||
apply(compiler) { | ||
compiler.hooks.done.tap('testPlugin', () => { | ||
if (!isInProcess && this.isInEnvironment) { | ||
console.log('PASS'); | ||
} else { | ||
console.log('FAIL'); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
module.exports = (env) => { | ||
return { | ||
mode: 'development', | ||
devtool: false, | ||
plugins: [new CustomTestPlugin(env.WEBPACK_BUILD)], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict'; | ||
|
||
const { run } = require('../../utils/test-utils'); | ||
|
||
describe('bundle variable', () => { | ||
it('compiles without flags and export variable', async () => { | ||
const { exitCode, stderr, stdout } = run(__dirname, [], false); | ||
|
||
expect(exitCode).toBe(0); | ||
expect(stderr).toBeFalsy(); | ||
expect(stdout).toContain('PASS'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('hello world'); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.