-
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.
- Loading branch information
1 parent
45f3646
commit 71c617c
Showing
6 changed files
with
115 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules/ | ||
dist/ | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
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 @@ | ||
<h1>Demo</h1> |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
process.env.NODE_ENV = 'development'; | ||
|
||
const path = require('path'); | ||
const serve = require('rollup-plugin-serve'); | ||
const configList = require('./config'); | ||
|
||
const resolveFile = function(filePath) { | ||
return path.join(__dirname, '../..', filePath) | ||
} | ||
|
||
const PORT = 3009; | ||
const devSite = `http://127.0.0.1:${PORT}`; | ||
const devPath = path.join('example', 'index.html'); | ||
const devUrl = `${devSite}/${devPath}`; | ||
|
||
setTimeout(()=>{ | ||
console.log(`[dev]: ${devUrl}`) | ||
}, 1000); | ||
|
||
configList.map((config, index) => { | ||
|
||
config.output.sourcemap = true; | ||
|
||
if (index === 0) { | ||
config.plugins = [ | ||
...config.plugins, | ||
...[ | ||
serve({ | ||
port: PORT, | ||
contentBase: [resolveFile('')] | ||
}) | ||
] | ||
] | ||
} | ||
|
||
return config; | ||
}) | ||
|
||
|
||
module.exports = configList; |
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,25 @@ | ||
const path = require('path'); | ||
const buble = require('rollup-plugin-buble'); | ||
const typescript = require('rollup-plugin-typescript'); | ||
const pkg = require('../../package.json') | ||
|
||
const resolveFile = function(filePath) { | ||
return path.join(__dirname, '../..', filePath) | ||
} | ||
|
||
module.exports = [ | ||
{ | ||
input: resolveFile('src/index.ts'), | ||
output: { | ||
file: resolveFile(pkg.main), | ||
// format: 'cjs', // node | ||
// format: 'iife', // web | ||
format: 'umd', // node + web | ||
name: 'node_universal_loggly', | ||
}, | ||
plugins: [ | ||
typescript(), | ||
buble(), | ||
], | ||
}, | ||
] |
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 @@ | ||
process.env.NODE_ENV = 'production'; | ||
|
||
const path = require('path'); | ||
const { uglify } = require('rollup-plugin-uglify'); | ||
const configList = require('./config'); | ||
|
||
const resolveFile = function(filePath) { | ||
return path.join(__dirname, '../..', filePath) | ||
} | ||
|
||
configList.map((config, index) => { | ||
|
||
config.output.sourcemap = false; | ||
config.plugins = [ | ||
...config.plugins, | ||
...[ | ||
uglify() | ||
] | ||
] | ||
|
||
return config; | ||
}) | ||
|
||
module.exports = configList; |