forked from magenta/magenta-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Webpack build system (POC) (magenta#191)
* Move shell scripts * Add webpack build system * Add lib build target file * Remove build demos shell script * Update yarn.lock * Update yarn prepublish
- Loading branch information
1 parent
6b95558
commit 5402534
Showing
9 changed files
with
1,985 additions
and
84 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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.
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,19 @@ | ||
/** | ||
* @license | ||
* Copyright 2018 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ============================================================================= | ||
*/ | ||
import * as mm from './index'; | ||
// tslint:disable-next-line | ||
(window as any).mm = mm; |
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,12 @@ | ||
export const baseConfig = { | ||
module: { | ||
rules: [{ | ||
test: /\.ts$/, | ||
exclude: /node_modules/, | ||
use: 'ts-loader', | ||
}], | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.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,28 @@ | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
|
||
import {baseConfig} from './base.config'; | ||
|
||
const getDemos = source => { | ||
return fs.readdirSync(source) | ||
.filter(name => path.extname(name) === '.html' && name !== 'index.html') | ||
.map(name => path.basename(name, '.html')); | ||
}; | ||
|
||
const entries = getDemos('./demos').reduce((obj, name) => { | ||
obj[name] = `./demos/${name}.ts`; | ||
return obj; | ||
}, {}); | ||
|
||
module.exports = { | ||
...baseConfig, | ||
devtool: 'inline-source-map', | ||
mode: 'development', | ||
entry: { | ||
...entries, | ||
}, | ||
output: { | ||
filename: '[name]_bundle.js', | ||
path: path.resolve(__dirname, '../demos'), | ||
}, | ||
}; |
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,14 @@ | ||
import * as path from 'path'; | ||
|
||
import {baseConfig} from './base.config'; | ||
|
||
module.exports = { | ||
...baseConfig, | ||
mode: 'production', | ||
entry: { | ||
magentamusic: './src/lib.ts', | ||
}, | ||
output: | ||
{filename: 'magentamusic.js', path: path.resolve(__dirname, '../dist')}, | ||
optimization: {minimize: true}, | ||
}; |
Oops, something went wrong.