-
-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build is now done using Rollup.
- Loading branch information
Showing
15 changed files
with
735 additions
and
92 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,11 +1,17 @@ | ||
{ | ||
"presets": [["env", { "loose": true, "modules": false }], "react"], | ||
"plugins": [ | ||
["transform-class-properties", { "loose": true }], | ||
"transform-object-rest-spread", | ||
"dynamic-import-node" | ||
], | ||
"presets": [ | ||
["env", { "loose": true }], | ||
"react" | ||
"transform-object-rest-spread" | ||
], | ||
"env": { | ||
"test": { | ||
"plugins": [ | ||
"dynamic-import-node", | ||
["transform-class-properties", { "loose": true }], | ||
"transform-object-rest-spread" | ||
], | ||
"presets": [["env", { "loose": true }], "react"] | ||
} | ||
} | ||
} |
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,5 +1,5 @@ | ||
node_modules/ | ||
/lib/ | ||
/coverage/ | ||
__fixtures__ | ||
example | ||
/dist/ | ||
__fixtures__/ | ||
/example/ |
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,3 +1,4 @@ | ||
node_modules | ||
/lib/ | ||
/coverage | ||
node_modules/ | ||
/dist/ | ||
/coverage/ | ||
bundle-stats.html |
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,7 +1,5 @@ | ||
/* | ||
!/babel.js | ||
!/server.js | ||
!/lib/**/*.js | ||
__fixtures__ | ||
*.test.js | ||
setupTests.js | ||
!/dist/**/*.js | ||
!/src/**/*.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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
node_modules/ | ||
/lib/ | ||
/coverage/ | ||
__fixtures__ | ||
/dist/ | ||
__fixtures__/ | ||
/example/ | ||
CHANGELOG.md |
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 +1 @@ | ||
module.exports = require('./lib/babel').default | ||
module.exports = require('./dist/loadable-components.babel.cjs.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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/* eslint-disable flowtype/require-valid-file-annotation, no-console, import/extensions */ | ||
import nodeResolve from 'rollup-plugin-node-resolve' | ||
import replace from 'rollup-plugin-replace' | ||
import commonjs from 'rollup-plugin-commonjs' | ||
import babel from 'rollup-plugin-babel' | ||
import json from 'rollup-plugin-json' | ||
import uglify from 'rollup-plugin-uglify' | ||
import visualizer from 'rollup-plugin-visualizer' | ||
import sourceMaps from 'rollup-plugin-sourcemaps' | ||
import pkg from './package.json' | ||
|
||
const commonPlugins = [ | ||
json(), | ||
nodeResolve(), | ||
sourceMaps(), | ||
babel({ plugins: ['external-helpers'] }), | ||
commonjs({ ignoreGlobal: true }), | ||
] | ||
|
||
const configBase = { | ||
input: 'src/index.js', | ||
external: ['react'].concat(Object.keys(pkg.dependencies)), | ||
plugins: commonPlugins, | ||
} | ||
|
||
const umdConfig = Object.assign({}, configBase, { | ||
output: { | ||
file: 'dist/loadable-components.js', | ||
format: 'umd', | ||
name: 'loadable', | ||
exports: 'named', | ||
globals: { react: 'React' }, | ||
sourcemap: true, | ||
}, | ||
}) | ||
|
||
const devUmdConfig = Object.assign({}, umdConfig, { | ||
plugins: umdConfig.plugins.concat( | ||
replace({ | ||
'process.env.NODE_ENV': JSON.stringify('development'), | ||
}), | ||
), | ||
}) | ||
|
||
const prodUmdConfig = Object.assign({}, umdConfig, { | ||
output: Object.assign({}, umdConfig.output, { | ||
file: 'dist/loadable-components.min.js', | ||
}), | ||
plugins: umdConfig.plugins.concat([ | ||
replace({ | ||
'process.env.NODE_ENV': JSON.stringify('production'), | ||
}), | ||
uglify({ sourceMap: true }), | ||
visualizer({ filename: './bundle-stats.html' }), | ||
]), | ||
}) | ||
|
||
const esConfig = Object.assign({}, configBase, { | ||
output: [ | ||
{ | ||
file: 'dist/loadable-components.es.js', | ||
format: 'es', | ||
globals: { react: 'React' }, | ||
sourcemap: true, | ||
}, | ||
{ | ||
file: 'dist/loadable-components.cjs.js', | ||
format: 'cjs', | ||
exports: 'named', | ||
globals: { react: 'React' }, | ||
sourcemap: true, | ||
}, | ||
], | ||
}) | ||
|
||
const serverConfig = Object.assign({}, configBase, { | ||
input: 'src/server/index.js', | ||
output: [ | ||
{ | ||
file: 'dist/loadable-components.server.cjs.js', | ||
format: 'cjs', | ||
exports: 'named', | ||
globals: { react: 'React' }, | ||
sourcemap: true, | ||
}, | ||
], | ||
}) | ||
|
||
const babelConfig = Object.assign({}, configBase, { | ||
input: 'src/babel.js', | ||
output: [ | ||
{ | ||
file: 'dist/loadable-components.babel.cjs.js', | ||
format: 'cjs', | ||
exports: 'named', | ||
globals: { react: 'React' }, | ||
sourcemap: true, | ||
}, | ||
], | ||
}) | ||
|
||
export default [ | ||
devUmdConfig, | ||
prodUmdConfig, | ||
esConfig, | ||
serverConfig, | ||
babelConfig, | ||
] |
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 +1 @@ | ||
module.exports = require('./lib/server') | ||
module.exports = require('./dist/loadable-components.server.cjs.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 |
---|---|---|
@@ -1,4 +1,2 @@ | ||
import createSymbol from './utils/createSymbol' | ||
|
||
export const LOADABLE_STATE = '__LOADABLE_STATE__' | ||
export const LOADABLE = createSymbol('loadable') | ||
export const LOADABLE = '@@loadable-components/loadable' |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.