-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(package): update to webpack 2 #1502
Changes from all commits
954fa30
4a39aa6
6a22680
175cbaa
81a2af4
2ced631
00dbe03
1641093
626d5b8
b323fce
751f4f2
a9ba2f5
0995151
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
const path = require('path') | ||
const yargs = require('yargs') | ||
|
||
const { argv } = yargs | ||
|
||
// ------------------------------------ | ||
// Environment vars | ||
// ------------------------------------ | ||
const env = process.env.NODE_ENV || 'development' | ||
const __DEV__ = env === 'development' | ||
const __STAGING__ = env === 'staging' | ||
|
@@ -18,12 +18,10 @@ let config = { | |
path_base: __dirname, | ||
dir_src: 'src', | ||
dir_dist: 'dist', | ||
dir_docs_root: 'docs', | ||
dir_docs_src: 'docs/app', | ||
dir_dll: 'dll', | ||
dir_docs_dist: 'docs/build', | ||
dir_docs_src: 'docs/app', | ||
dir_umd_dist: 'dist/umd', | ||
dir_server: 'server', | ||
dir_test: 'test', | ||
} | ||
|
||
// ------------------------------------ | ||
|
@@ -35,10 +33,10 @@ const paths = { | |
base, | ||
src: base.bind(null, config.dir_src), | ||
dist: base.bind(null, config.dir_dist), | ||
test: base.bind(null, config.dir_test), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cruft. |
||
dll: base.bind(null, config.dir_dll), | ||
docsDist: base.bind(null, config.dir_docs_dist), | ||
umdDist: base.bind(null, config.dir_umd_dist), | ||
docsSrc: base.bind(null, config.dir_docs_src), | ||
umdDist: base.bind(null, config.dir_umd_dist), | ||
} | ||
|
||
config = Object.assign({}, config, { | ||
|
@@ -53,30 +51,23 @@ config = Object.assign({}, config, { | |
// ---------------------------------- | ||
// Compiler Configuration | ||
// ---------------------------------- | ||
compiler_devtool: __DEV__ && 'cheap-source-map' | ||
|| __TEST__ && 'cheap-source-map' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. karma-webpack use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use I'm open to changes here but I'd like to address the issue of too many tests taking too long to run while we're at it, or stick with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted, |
||
|| __STAGING__ && 'source-map', | ||
compiler_devtool: (__DEV__ || __TEST__) && 'cheap-source-map' || __STAGING__ && 'source-map', | ||
compiler_globals: { | ||
process: { | ||
env: { | ||
NODE_ENV: JSON.stringify(env), | ||
}, | ||
}, | ||
__DEV__, | ||
__STAGING__, | ||
__PATH_SEP__: JSON.stringify(path.sep), | ||
__TEST__, | ||
__PROD__, | ||
}, | ||
compiler_hash_type: __PROD__ ? 'chunkhash' : 'hash', | ||
compiler_inline_manifest: false, | ||
compiler_fail_on_warning: __TEST__ || __PROD__, | ||
compiler_lint: argv.lint !== false, | ||
compiler_quiet: false, | ||
compiler_output_path: paths.base(config.dir_docs_dist), | ||
compiler_public_path: __PROD__ ? '//cdn.rawgit.com/Semantic-Org/Semantic-UI-React/gh-pages/' : '/', | ||
compiler_vendor: [ | ||
'babel-standalone', | ||
'brace', | ||
'brace/ext/language_tools', | ||
'brace/mode/jsx', | ||
'brace/mode/html', | ||
'brace/theme/tomorrow', | ||
'classnames', | ||
'copy-to-clipboard', | ||
'faker', | ||
'react', | ||
'react-ace', | ||
'react-dom', | ||
], | ||
compiler_stats: { | ||
hash: false, // the hash of the compilation | ||
version: false, // webpack version info | ||
|
@@ -95,19 +86,20 @@ config = Object.assign({}, config, { | |
chunksSort: '', // (string) sort the chunks by that field | ||
assetsSort: '', // (string) sort the assets by that field | ||
}, | ||
compiler_globals: { | ||
process: { | ||
env: { | ||
NODE_ENV: JSON.stringify(env), | ||
}, | ||
}, | ||
__DEV__, | ||
__DEBUG__: !!argv.debug, | ||
__STAGING__, | ||
__PATH_SEP__: JSON.stringify(path.sep), | ||
__TEST__, | ||
__PROD__, | ||
}, | ||
compiler_vendor: [ | ||
'babel-standalone', | ||
'brace', | ||
'brace/ext/language_tools', | ||
'brace/mode/jsx', | ||
'brace/mode/html', | ||
'brace/theme/tomorrow', | ||
'classnames', | ||
'copy-to-clipboard', | ||
'faker', | ||
'react', | ||
'react-ace', | ||
'react-dom', | ||
], | ||
}) | ||
|
||
module.exports = config |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,7 +146,7 @@ class ComponentExample extends Component { | |
getOriginalSourceCode = () => { | ||
const { examplePath } = this.props | ||
|
||
if (!this.sourceCode) this.sourceCode = require(`!raw!docs/app/Examples/${examplePath}`) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update loader's usage |
||
if (!this.sourceCode) this.sourceCode = require(`!raw-loader!../../Examples/${examplePath}`) | ||
|
||
return this.sourceCode | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,12 +7,12 @@ describe('isBrowser', () => { | |
}) | ||
|
||
it('should return false when there is no document', () => { | ||
require('imports?document=>undefined!src/lib/isBrowser').default.should.be.false() | ||
require('imports?document=>null!src/lib/isBrowser').default.should.be.false() | ||
require('imports-loader?document=>undefined!src/lib/isBrowser').default.should.be.false() | ||
require('imports-loader?document=>null!src/lib/isBrowser').default.should.be.false() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update loader's usage |
||
}) | ||
|
||
it('should return false when there is no window', () => { | ||
require('imports?window=>undefined!src/lib/isBrowser').default.should.be.false() | ||
require('imports?window=>null!src/lib/isBrowser').default.should.be.false() | ||
require('imports-loader?window=>undefined!src/lib/isBrowser').default.should.be.false() | ||
require('imports-loader?window=>null!src/lib/isBrowser').default.should.be.false() | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cruft.