mirror of
https://github.com/Alamantus/Lexiconga.git
synced 2025-07-12 10:25:54 +02:00
Fix code style
Remove misguided comma-first style, add floating commas, and improve spacing and parentheses for single-param inline arrow functions.
This commit is contained in:
parent
d4043e2d79
commit
a443fe4c3f
16 changed files with 401 additions and 391 deletions
|
@ -28,7 +28,7 @@ export const MainDisplay = ({dictionaryInfo, wordsToDisplay, updateDisplay, last
|
||||||
details={{
|
details={{
|
||||||
custom: [
|
custom: [
|
||||||
{
|
{
|
||||||
name: 'Test Tab'
|
name: 'Test Tab',
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -3,10 +3,10 @@ import Component from 'inferno-component';
|
||||||
import marked from 'marked';
|
import marked from 'marked';
|
||||||
|
|
||||||
const DISPLAY = {
|
const DISPLAY = {
|
||||||
NONE: false
|
NONE: false,
|
||||||
, DESCRIPTION: 1
|
DESCRIPTION: 1,
|
||||||
, DETAILS: 2
|
DETAILS: 2,
|
||||||
, STATS: 3
|
STATS: 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
export class DictionaryDetails extends Component {
|
export class DictionaryDetails extends Component {
|
||||||
|
@ -14,15 +14,15 @@ export class DictionaryDetails extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
currentDisplay: DISPLAY.NONE
|
currentDisplay: DISPLAY.NONE,
|
||||||
}
|
}
|
||||||
|
|
||||||
this._descriptionHTML = marked(props.description);
|
this._descriptionHTML = marked(props.description);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
const currentDescription = this.props.description
|
const currentDescription = this.props.description,
|
||||||
, nextDescription = nextProps.description;
|
nextDescription = nextProps.description;
|
||||||
|
|
||||||
if (currentDescription !== nextDescription) {
|
if (currentDescription !== nextDescription) {
|
||||||
this._descriptionHTML = marked(nextProps.description);
|
this._descriptionHTML = marked(nextProps.description);
|
||||||
|
@ -33,7 +33,7 @@ export class DictionaryDetails extends Component {
|
||||||
display = (this.state.currentDisplay !== display) ? display : DISPLAY.NONE;
|
display = (this.state.currentDisplay !== display) ? display : DISPLAY.NONE;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
currentDisplay: display
|
currentDisplay: display,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ export class WordDisplay extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
isEditing: false
|
isEditing: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@ export class IPAField extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
value: props.value || ''
|
value: props.value || '',
|
||||||
, doShowHelp: false
|
doShowHelp: false,
|
||||||
, doShowTable: false
|
doShowTable: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.field = null;
|
this.field = null;
|
||||||
|
@ -27,7 +27,7 @@ export class IPAField extends Component {
|
||||||
|
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
this.setState({
|
this.setState({
|
||||||
value: nextProps.value
|
value: nextProps.value,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,9 @@ export class IPAField extends Component {
|
||||||
<section className='modal-card-body'>
|
<section className='modal-card-body'>
|
||||||
|
|
||||||
<div className='content'
|
<div className='content'
|
||||||
dangerouslySetInnerHTML={{__html: phondueUsage}} />
|
dangerouslySetInnerHTML={{
|
||||||
|
__html: phondueUsage,
|
||||||
|
}} />
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
@ -63,7 +65,7 @@ export class IPAField extends Component {
|
||||||
<IPATable
|
<IPATable
|
||||||
value={ this.state.value }
|
value={ this.state.value }
|
||||||
close={ () => this.setState({ doShowTable: false }) }
|
close={ () => this.setState({ doShowTable: false }) }
|
||||||
update={newValue => this.setState({ value: newValue }, this.field.focus())} />
|
update={ (newValue) => this.setState({ value: newValue }, this.field.focus()) } />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,12 +92,12 @@ export class IPAField extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onInput (event) {
|
onInput (event) {
|
||||||
let val = event.target.value
|
let val = event.target.value,
|
||||||
, pos = this.field.selectionStart || val.length;
|
pos = this.field.selectionStart || val.length;
|
||||||
|
|
||||||
if (event.key) {
|
if (event.key) {
|
||||||
const key = event.key
|
const key = event.key,
|
||||||
, digraph = digraphs[val.substr(pos - 1, 1) + key];
|
digraph = digraphs[val.substr(pos - 1, 1) + key];
|
||||||
|
|
||||||
if (digraph) {
|
if (digraph) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -116,11 +118,13 @@ export class IPAField extends Component {
|
||||||
<div className='field'>
|
<div className='field'>
|
||||||
<label className='label'>Pronunciation</label>
|
<label className='label'>Pronunciation</label>
|
||||||
<p className='control'>
|
<p className='control'>
|
||||||
<input className='input' type='text' disabled={!!this.props.isDisplayOnly} placeholder='[prə.ˌnʌn.si.ˈeɪ.ʃən]'
|
<input className='input' type='text'
|
||||||
ref={input => this.field = input}
|
placeholder='[prə.ˌnʌn.si.ˈeɪ.ʃən]'
|
||||||
|
disabled={ !!this.props.isDisplayOnly }
|
||||||
|
ref={ (input) => this.field = input }
|
||||||
value={ this.state.value }
|
value={ this.state.value }
|
||||||
onInput={event => this.onInput(event)}
|
onInput={ (event) => this.onInput(event) }
|
||||||
onKeyDown={event => this.onInput(event)}
|
onKeyDown={ (event) => this.onInput(event) }
|
||||||
onChange={ () => this.props.onChange(this.state.value) } />
|
onChange={ () => this.props.onChange(this.state.value) } />
|
||||||
</p>
|
</p>
|
||||||
{ this.showButtons() }
|
{ this.showButtons() }
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -56,7 +56,7 @@ export class SearchBox extends Component {
|
||||||
<p className='control'>
|
<p className='control'>
|
||||||
<span className='select'>
|
<span className='select'>
|
||||||
<select value={ this.state.searchingIn }
|
<select value={ this.state.searchingIn }
|
||||||
onChange={event => {
|
onChange={(event) => {
|
||||||
this.setState({ searchingIn: event.target.value });
|
this.setState({ searchingIn: event.target.value });
|
||||||
}}>
|
}}>
|
||||||
<option value='name'>Word</option>
|
<option value='name'>Word</option>
|
||||||
|
@ -67,11 +67,11 @@ export class SearchBox extends Component {
|
||||||
</p>
|
</p>
|
||||||
<p className='control is-expanded'>
|
<p className='control is-expanded'>
|
||||||
<input className='input' type='text' placeholder='Search Term'
|
<input className='input' type='text' placeholder='Search Term'
|
||||||
ref={input => {
|
ref={(input) => {
|
||||||
this.searchBox = input;
|
this.searchBox = input;
|
||||||
}}
|
}}
|
||||||
value={ this.state.searchTerm }
|
value={ this.state.searchTerm }
|
||||||
onChange={event => {
|
onChange={(event) => {
|
||||||
console.log(event);
|
console.log(event);
|
||||||
this.setState({ searchTerm: event.target.value });
|
this.setState({ searchTerm: event.target.value });
|
||||||
}} />
|
}} />
|
||||||
|
@ -115,7 +115,7 @@ export class SearchBox extends Component {
|
||||||
<input type='radio' name='searchmethod'
|
<input type='radio' name='searchmethod'
|
||||||
value={ METHOD.contains }
|
value={ METHOD.contains }
|
||||||
checked={ this.state.searchMethod === METHOD.contains }
|
checked={ this.state.searchMethod === METHOD.contains }
|
||||||
onClick={event => {
|
onClick={(event) => {
|
||||||
if (event.currentTarget.checked) {
|
if (event.currentTarget.checked) {
|
||||||
this.setState({
|
this.setState({
|
||||||
searchMethod: event.currentTarget.value,
|
searchMethod: event.currentTarget.value,
|
||||||
|
@ -131,7 +131,7 @@ export class SearchBox extends Component {
|
||||||
<input type='radio' name='searchmethod'
|
<input type='radio' name='searchmethod'
|
||||||
value={ METHOD.startsWith }
|
value={ METHOD.startsWith }
|
||||||
checked={ this.state.searchMethod === METHOD.startsWith }
|
checked={ this.state.searchMethod === METHOD.startsWith }
|
||||||
onClick={event => {
|
onClick={(event) => {
|
||||||
if (event.currentTarget.checked) {
|
if (event.currentTarget.checked) {
|
||||||
this.setState({
|
this.setState({
|
||||||
searchMethod: event.currentTarget.value,
|
searchMethod: event.currentTarget.value,
|
||||||
|
@ -147,7 +147,7 @@ export class SearchBox extends Component {
|
||||||
<input type='radio' name='searchmethod'
|
<input type='radio' name='searchmethod'
|
||||||
value={ METHOD.endsWith }
|
value={ METHOD.endsWith }
|
||||||
checked={ this.state.searchMethod === METHOD.endsWith }
|
checked={ this.state.searchMethod === METHOD.endsWith }
|
||||||
onClick={event => {
|
onClick={(event) => {
|
||||||
if (event.currentTarget.checked) {
|
if (event.currentTarget.checked) {
|
||||||
this.setState({
|
this.setState({
|
||||||
searchMethod: event.currentTarget.value,
|
searchMethod: event.currentTarget.value,
|
||||||
|
@ -163,7 +163,7 @@ export class SearchBox extends Component {
|
||||||
<input type='radio' name='searchmethod'
|
<input type='radio' name='searchmethod'
|
||||||
value={ METHOD.isExactly }
|
value={ METHOD.isExactly }
|
||||||
checked={ this.state.searchMethod === METHOD.isExactly }
|
checked={ this.state.searchMethod === METHOD.isExactly }
|
||||||
onClick={event => {
|
onClick={(event) => {
|
||||||
if (event.currentTarget.checked) {
|
if (event.currentTarget.checked) {
|
||||||
this.setState({
|
this.setState({
|
||||||
searchMethod: event.currentTarget.value,
|
searchMethod: event.currentTarget.value,
|
||||||
|
@ -234,13 +234,13 @@ export class SearchBox extends Component {
|
||||||
|
|
||||||
showHeader () {
|
showHeader () {
|
||||||
this.setState({
|
this.setState({
|
||||||
showHeader: true
|
showHeader: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
hideHeader () {
|
hideHeader () {
|
||||||
this.setState({
|
this.setState({
|
||||||
showHeader: false
|
showHeader: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,24 +9,24 @@ export class WordForm extends Component {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
wordName: this.props.name || ''
|
wordName: this.props.name || '',
|
||||||
, wordPronunciation: this.props.pronunciation || ''
|
wordPronunciation: this.props.pronunciation || '',
|
||||||
, wordPartOfSpeech: this.props.partOfSpeech || ''
|
wordPartOfSpeech: this.props.partOfSpeech || '',
|
||||||
, wordDefinition: this.props.definition || ''
|
wordDefinition: this.props.definition || '',
|
||||||
, wordDetails: this.props.details || ''
|
wordDetails: this.props.details || '',
|
||||||
|
|
||||||
, nameIsValid: true
|
nameIsValid: true,
|
||||||
, pronunciationIsValid: true
|
pronunciationIsValid: true,
|
||||||
, partOfSpeechIsValid: true
|
partOfSpeechIsValid: true,
|
||||||
, definitionIsValid: true
|
definitionIsValid: true,
|
||||||
, detailsIsValid: true
|
detailsIsValid: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isValidWord () {
|
isValidWord () {
|
||||||
let nameIsValid = true
|
let nameIsValid = true,
|
||||||
, definitionIsValid = true
|
definitionIsValid = true,
|
||||||
, detailsIsValid = true;
|
detailsIsValid = true;
|
||||||
|
|
||||||
if (this.state.wordName === '') {
|
if (this.state.wordName === '') {
|
||||||
nameIsValid = false;
|
nameIsValid = false;
|
||||||
|
@ -43,9 +43,9 @@ export class WordForm extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
nameIsValid
|
nameIsValid,
|
||||||
, definitionIsValid
|
definitionIsValid,
|
||||||
, detailsIsValid
|
detailsIsValid,
|
||||||
});
|
});
|
||||||
|
|
||||||
return nameIsValid == true && definitionIsValid == true && detailsIsValid == true;
|
return nameIsValid == true && definitionIsValid == true && detailsIsValid == true;
|
||||||
|
@ -53,11 +53,11 @@ export class WordForm extends Component {
|
||||||
|
|
||||||
submitWord () {
|
submitWord () {
|
||||||
const word = new Word({
|
const word = new Word({
|
||||||
name: this.state.wordName
|
name: this.state.wordName,
|
||||||
, pronunciation: this.state.wordPronunciation
|
pronunciation: this.state.wordPronunciation,
|
||||||
, partOfSpeech: this.state.wordPartOfSpeech
|
partOfSpeech: this.state.wordPartOfSpeech,
|
||||||
, definition: this.state.wordDefinition
|
definition: this.state.wordDefinition,
|
||||||
, details: this.state.wordDetails
|
details: this.state.wordDetails,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -80,11 +80,11 @@ export class WordForm extends Component {
|
||||||
|
|
||||||
clearForm () {
|
clearForm () {
|
||||||
this.setState({
|
this.setState({
|
||||||
wordName: ''
|
wordName: '',
|
||||||
, wordPronunciation: ''
|
wordPronunciation: '',
|
||||||
, wordPartOfSpeech: ''
|
wordPartOfSpeech: '',
|
||||||
, wordDefinition: ''
|
wordDefinition: '',
|
||||||
, wordDetails: ''
|
wordDetails: '',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,20 +108,22 @@ export class WordForm extends Component {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<IPAField value={ this.state.wordPronunciation }
|
<IPAField value={ this.state.wordPronunciation }
|
||||||
onChange={newValue => this.setState({ wordPronunciation: newValue })} />
|
onChange={ (newValue) => this.setState({ wordPronunciation: newValue }) } />
|
||||||
|
|
||||||
<div className='field'>
|
<div className='field'>
|
||||||
<label className='label'>Part of Speech</label>
|
<label className='label'>Part of Speech</label>
|
||||||
<p className='control'>
|
<p className='control'>
|
||||||
<span className='select'>
|
<span className='select'>
|
||||||
<select value={ this.state.wordPartOfSpeech }
|
<select value={ this.state.wordPartOfSpeech }
|
||||||
onChange={event => {
|
onChange={(event) => {
|
||||||
this.setState({ wordPartOfSpeech: event.target.value });
|
this.setState({ wordPartOfSpeech: event.target.value });
|
||||||
}}>
|
}}>
|
||||||
<option value=''></option>
|
<option value=''></option>
|
||||||
{this.props.partsOfSpeech.map((partOfSpeech) => {
|
{this.props.partsOfSpeech.map((partOfSpeech) => {
|
||||||
return (
|
return (
|
||||||
<option value={partOfSpeech}>{partOfSpeech}</option>
|
<option value={ partOfSpeech }>
|
||||||
|
{ partOfSpeech }
|
||||||
|
</option>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -25,7 +25,7 @@ export class Header extends Component {
|
||||||
<div className='nav-item'>
|
<div className='nav-item'>
|
||||||
<SearchBox
|
<SearchBox
|
||||||
partsOfSpeech={ this.props.partsOfSpeech }
|
partsOfSpeech={ this.props.partsOfSpeech }
|
||||||
search={ searchConfig => this.props.search(searchConfig) } />
|
search={ (searchConfig) => this.props.search(searchConfig) } />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class App extends Component {
|
||||||
// const {searchIn, searchTerm, filteredPartsOfSpeech} = this.state.searchConfig;
|
// const {searchIn, searchTerm, filteredPartsOfSpeech} = this.state.searchConfig;
|
||||||
|
|
||||||
// TODO: Sort out searching to remove this temporary solution.
|
// TODO: Sort out searching to remove this temporary solution.
|
||||||
dictionary.wordsPromise.then(words => {
|
dictionary.wordsPromise.then((words) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
displayedWords: words,
|
displayedWords: words,
|
||||||
})
|
})
|
||||||
|
@ -68,7 +68,7 @@ class App extends Component {
|
||||||
<div>
|
<div>
|
||||||
<Header
|
<Header
|
||||||
partsOfSpeech={ this.state.partsOfSpeech }
|
partsOfSpeech={ this.state.partsOfSpeech }
|
||||||
search={ searchConfig => this.search(searchConfig) } />
|
search={ (searchConfig) => this.search(searchConfig) } />
|
||||||
|
|
||||||
<MainDisplay
|
<MainDisplay
|
||||||
dictionaryInfo={ this.dictionaryInfo }
|
dictionaryInfo={ this.dictionaryInfo }
|
||||||
|
|
|
@ -4,10 +4,10 @@ import wordDb from './WordDatabase';
|
||||||
import idManager from './IDManager';
|
import idManager from './IDManager';
|
||||||
|
|
||||||
const defaultDictionary = {
|
const defaultDictionary = {
|
||||||
name: 'New'
|
name: 'New',
|
||||||
, specification: 'Dictionary'
|
specification: 'Dictionary',
|
||||||
, description: 'A new dictionary.'
|
description: 'A new dictionary.',
|
||||||
, partsOfSpeech: ['Noun', 'Adjective', 'Verb']
|
partsOfSpeech: ['Noun', 'Adjective', 'Verb'],
|
||||||
}
|
}
|
||||||
|
|
||||||
class DictionaryData {
|
class DictionaryData {
|
||||||
|
@ -80,8 +80,8 @@ class DictionaryData {
|
||||||
if (Array.isArray(partOfSpeech)) {
|
if (Array.isArray(partOfSpeech)) {
|
||||||
words = words.anyOf(partOfSpeech);
|
words = words.anyOf(partOfSpeech);
|
||||||
} else {
|
} else {
|
||||||
assert(typeof partOfSpeech === 'string'
|
assert(typeof partOfSpeech === 'string',
|
||||||
, 'You must use either a string or an array when searching for words with a particular part of speech');
|
'You must use either a string or an array when searching for words with a particular part of speech');
|
||||||
|
|
||||||
words = words.equals(partOfSpeech);
|
words = words.equals(partOfSpeech);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ export class Word {
|
||||||
this.modifiedTime = null;
|
this.modifiedTime = null;
|
||||||
|
|
||||||
return wordDb.words.add(this)
|
return wordDb.words.add(this)
|
||||||
.then(id => {
|
.then((id) => {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
console.log('Word added successfully');
|
console.log('Word added successfully');
|
||||||
})
|
})
|
||||||
|
@ -31,7 +31,7 @@ export class Word {
|
||||||
this.modifiedTime = timestampInSeconds;
|
this.modifiedTime = timestampInSeconds;
|
||||||
|
|
||||||
return wordDb.words.put(this, wordId)
|
return wordDb.words.put(this, wordId)
|
||||||
.then(id => {
|
.then((id) => {
|
||||||
console.log('Word modified successfully');
|
console.log('Word modified successfully');
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import {Word} from './Word';
|
||||||
|
|
||||||
const db = new Dexie('Lexiconga');
|
const db = new Dexie('Lexiconga');
|
||||||
db.version(1).stores({
|
db.version(1).stores({
|
||||||
words: '++id, name, partOfSpeech, createdTime, modifiedTime'
|
words: '++id, name, partOfSpeech, createdTime, modifiedTime',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (['emptydb', 'donotsave'].includes(process.env.NODE_ENV)) {
|
if (['emptydb', 'donotsave'].includes(process.env.NODE_ENV)) {
|
||||||
|
|
|
@ -13,97 +13,101 @@ const BUILD_DIR = path.resolve(__dirname, 'public');
|
||||||
const APP_DIR = path.resolve(__dirname, 'src');
|
const APP_DIR = path.resolve(__dirname, 'src');
|
||||||
|
|
||||||
const webpackConfig = {
|
const webpackConfig = {
|
||||||
entry: APP_DIR + '/index.jsx'
|
entry: APP_DIR + '/index.jsx',
|
||||||
, output: {
|
|
||||||
path: BUILD_DIR
|
output: {
|
||||||
, filename: 'lexiconga.js'
|
path: BUILD_DIR,
|
||||||
}
|
filename: 'lexiconga.js',
|
||||||
, module: {
|
},
|
||||||
|
|
||||||
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: (/\.scss$/)
|
test: (/\.scss$/),
|
||||||
, exclude: (/node_modules/)
|
exclude: (/node_modules/),
|
||||||
, use: [
|
use: [
|
||||||
'style-loader'
|
'style-loader',
|
||||||
, 'css-loader'
|
'css-loader',
|
||||||
, {
|
{
|
||||||
loader: 'sass-loader'
|
loader: 'sass-loader',
|
||||||
, options: {
|
options: {
|
||||||
file: './src/sass/styles.scss',
|
file: './src/sass/styles.scss',
|
||||||
outFile: './public/styles.css',
|
outFile: './public/styles.css',
|
||||||
outputStyle: 'compressed'
|
outputStyle: 'compressed',
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
, {
|
{
|
||||||
test: (/\.html$/)
|
test: (/\.html$/),
|
||||||
, exclude: (/node_modules/)
|
exclude: (/node_modules/),
|
||||||
, use: [
|
use: [
|
||||||
'html-loader'
|
'html-loader',
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
, {
|
{
|
||||||
test: (/\.txt$/)
|
test: (/\.txt$/),
|
||||||
, exclude: (/node_modules/)
|
exclude: (/node_modules/),
|
||||||
, use: [
|
use: [
|
||||||
'raw-loader'
|
'raw-loader'
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
, {
|
|
||||||
test: (/\.jsx?$/)
|
|
||||||
, exclude: (/node_modules/)
|
|
||||||
, use: [
|
|
||||||
{
|
{
|
||||||
loader: 'babel-loader'
|
test: (/\.jsx?$/),
|
||||||
, options: {
|
exclude: (/node_modules/),
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
presets: [
|
presets: [
|
||||||
'es2016'
|
'es2016',
|
||||||
]
|
],
|
||||||
, plugins: [
|
plugins: [
|
||||||
'inferno'
|
'inferno',
|
||||||
]
|
],
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
],
|
||||||
]
|
},
|
||||||
}
|
|
||||||
, {
|
|
||||||
test: (/\.(png|woff|woff2|eot|ttf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/)
|
|
||||||
, use: [
|
|
||||||
{
|
{
|
||||||
loader: 'url-loader'
|
test: (/\.(png|woff|woff2|eot|ttf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/),
|
||||||
, options: {
|
use: [
|
||||||
limit: 100000
|
{
|
||||||
, mimetype: 'application/font-woff'
|
loader: 'url-loader',
|
||||||
, name: './assets/fonts/[name].[ext]'
|
options: {
|
||||||
|
limit: 100000,
|
||||||
|
mimetype: 'application/font-woff',
|
||||||
|
name: './assets/fonts/[name].[ext]',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
, resolve: {
|
|
||||||
|
resolve: {
|
||||||
extensions: [
|
extensions: [
|
||||||
'.js'
|
'.js',
|
||||||
, '.jsx'
|
'.jsx',
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
, plugins: [
|
|
||||||
|
plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'NODE_ENV': JSON.stringify(BUILDMODE)
|
'NODE_ENV': JSON.stringify(BUILDMODE),
|
||||||
}
|
},
|
||||||
})
|
}),
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
if (BUILDMODE === 'production') {
|
if (BUILDMODE === 'production') {
|
||||||
webpackConfig.plugins.push(
|
webpackConfig.plugins.push(
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
mangle: true
|
mangle: true,
|
||||||
, compress: {
|
compress: {
|
||||||
warnings: false
|
warnings: false,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue