-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(webpack): build your lib using webpack
dropped building with @babel/cli in favor of using webpack BREAKING CHANGE: @babel/cli dropped and the build script uses webpack and babel-loader
- Loading branch information
Showing
7 changed files
with
51 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,5 @@ | |
"targets": { "node": 8 } | ||
} | ||
] | ||
], | ||
"plugins": ["add-module-exports"] | ||
] | ||
} |
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
27 changes: 27 additions & 0 deletions
27
src/app/generators/project/templates/config/webpack.config.js
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,27 @@ | ||
const path = require('path'); | ||
|
||
const config = { | ||
mode: 'production', | ||
target: 'node', | ||
|
||
entry: path.resolve(__dirname, '../src/index.js'), | ||
|
||
output: { | ||
path: path.resolve(__dirname, '../dist'), | ||
filename: 'index.js', | ||
library: '<%= projectName %>', | ||
libraryTarget: 'umd', | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
module.exports = config; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import <%= camelProject %> from '.'; | ||
import <%= camelProject %>, { namedExport } from './index'; | ||
|
||
test('output', () => { | ||
expect(<%= camelProject %>('🐰')).toBe('🐰'); | ||
expect(<%= camelProject %>()).toBe('No args passed!'); | ||
|
||
expect(namedExport('🐰')).toBe('🐰'); | ||
expect(namedExport()).toBe('No args passed!'); | ||
}); |
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