mirror of
https://github.com/yldio/copilot.git
synced 2024-11-11 05:40:11 +02:00
fix @ui require
This commit is contained in:
parent
52ca697962
commit
fffa1192d6
@ -42,7 +42,8 @@
|
||||
"redux-promise-middleware": "^4.2.0",
|
||||
"redux-thunk": "^2.1.0",
|
||||
"st": "^1.2.0",
|
||||
"styled-components": "^1.1.3"
|
||||
"styled-components": "^1.1.3",
|
||||
"url-loader": "^0.5.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^0.17.0",
|
||||
|
@ -2,26 +2,34 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const plugins = require('./plugins');
|
||||
const CONTEXT = path.join(__dirname, '../src');
|
||||
const STATIC = path.join(__dirname, '../static');
|
||||
const ROOT = path.join(__dirname, '../..');
|
||||
const paths = require('./paths');
|
||||
|
||||
const {
|
||||
ROOT,
|
||||
MODULES,
|
||||
FRONTEND,
|
||||
UI,
|
||||
STATIC
|
||||
} = paths;
|
||||
|
||||
module.exports = {
|
||||
context: CONTEXT,
|
||||
context: ROOT,
|
||||
entry: `./${path.relative(ROOT, path.join(FRONTEND, 'index.js'))}`,
|
||||
resolve: {
|
||||
modules: [
|
||||
ROOT,
|
||||
'node_modules'
|
||||
],
|
||||
alias: fs.readdirSync(CONTEXT)
|
||||
.map((name) => path.join(CONTEXT, name))
|
||||
modules: MODULES,
|
||||
alias: fs.readdirSync(FRONTEND)
|
||||
.map((name) => path.join(FRONTEND, name))
|
||||
.filter((fullpath) => fs.statSync(fullpath).isDirectory())
|
||||
.reduce((aliases, fullpath) => Object.assign(aliases, {
|
||||
[`@${path.basename(fullpath)}`]: fullpath
|
||||
}), {
|
||||
'@root': CONTEXT
|
||||
'@root': FRONTEND,
|
||||
'@ui': UI
|
||||
})
|
||||
},
|
||||
resolveLoader: {
|
||||
modules: MODULES
|
||||
},
|
||||
output: {
|
||||
path: STATIC,
|
||||
publicPath: '/static/',
|
||||
@ -36,13 +44,30 @@ module.exports = {
|
||||
loaders: [{
|
||||
test: /js?$/,
|
||||
exclude: /node_modules/,
|
||||
include: [CONTEXT],
|
||||
include: [
|
||||
FRONTEND,
|
||||
UI
|
||||
],
|
||||
loaders: ['babel-loader']
|
||||
}, {
|
||||
test: /\.json?$/,
|
||||
exclude: /node_modules/,
|
||||
include: [CONTEXT],
|
||||
include: [
|
||||
FRONTEND,
|
||||
UI
|
||||
],
|
||||
loaders: ['json-loader']
|
||||
}, {
|
||||
test: /\.png$/,
|
||||
exclude: /node_modules/,
|
||||
include: [
|
||||
FRONTEND,
|
||||
UI
|
||||
],
|
||||
loader: 'url-loader',
|
||||
query: {
|
||||
mimetype: 'image/png'
|
||||
}
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ module.exports = Object.assign(base, {
|
||||
'react-hot-loader/patch',
|
||||
'webpack-dev-server/client?http://localhost:8080',
|
||||
'webpack/hot/only-dev-server',
|
||||
'./index.js'
|
||||
base.entry
|
||||
],
|
||||
plugins: base.plugins.concat([
|
||||
plugins['named-modules'],
|
||||
|
17
frontend/webpack/paths.js
Normal file
17
frontend/webpack/paths.js
Normal file
@ -0,0 +1,17 @@
|
||||
const path = require('path');
|
||||
|
||||
const ROOT = path.join(__dirname, '../..');
|
||||
const UI = path.join(ROOT, 'ui');
|
||||
const FRONTEND = path.join(ROOT, 'frontend');
|
||||
|
||||
module.exports = {
|
||||
ROOT,
|
||||
MODULES: [
|
||||
path.join(FRONTEND, 'node_modules'),
|
||||
path.join(UI, 'node_modules'),
|
||||
'node_modules'
|
||||
],
|
||||
FRONTEND: path.join(FRONTEND, 'src'),
|
||||
UI: path.join(UI, 'src'),
|
||||
STATIC: path.join(FRONTEND, 'static')
|
||||
};
|
@ -4,9 +4,6 @@ const base = require('./base');
|
||||
|
||||
module.exports = Object.assign(base, {
|
||||
devtool: 'hidden-source-map',
|
||||
entry: [
|
||||
'./index.js'
|
||||
],
|
||||
plugins: base.plugins.concat([
|
||||
// plugins['occurrence-order'],
|
||||
// plugins['aggressive-merging'],
|
||||
|
@ -1,25 +1,8 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const base = require('./base');
|
||||
const plugins = require('./plugins');
|
||||
const CONTEXT = path.join(__dirname, '../src');
|
||||
const ROOT = path.join(__dirname, '../..');
|
||||
|
||||
module.exports = {
|
||||
resolve: {
|
||||
modules: [
|
||||
ROOT,
|
||||
'node_modules'
|
||||
],
|
||||
alias: fs.readdirSync(CONTEXT)
|
||||
.map((name) => path.join(CONTEXT, name))
|
||||
.filter((fullpath) => fs.statSync(fullpath).isDirectory())
|
||||
.reduce((aliases, fullpath) => Object.assign(aliases, {
|
||||
[`@${path.basename(fullpath)}`]: fullpath
|
||||
}), {
|
||||
'@root': CONTEXT
|
||||
})
|
||||
},
|
||||
resolve: base.resolve,
|
||||
output: {
|
||||
libraryTarget: 'commonjs2'
|
||||
},
|
||||
@ -28,17 +11,5 @@ module.exports = {
|
||||
plugins['no-errors'],
|
||||
plugins['define']
|
||||
],
|
||||
module: {
|
||||
loaders: [{
|
||||
test: /js?$/,
|
||||
exclude: /node_modules/,
|
||||
include: [CONTEXT],
|
||||
loaders: ['babel-loader']
|
||||
}, {
|
||||
test: /\.json?$/,
|
||||
exclude: /node_modules/,
|
||||
include: [CONTEXT],
|
||||
loaders: ['json-loader']
|
||||
}]
|
||||
}
|
||||
module: base.module
|
||||
};
|
||||
|
@ -3360,7 +3360,7 @@ loader-runner@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.2.0.tgz#824c1b699c4e7a2b6501b85902d5b862bf45b3fa"
|
||||
|
||||
loader-utils@^0.2.11, loader-utils@^0.2.16:
|
||||
loader-utils@^0.2.11, loader-utils@^0.2.16, loader-utils@0.2.x:
|
||||
version "0.2.16"
|
||||
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.16.tgz#f08632066ed8282835dff88dfb52704765adee6d"
|
||||
dependencies:
|
||||
@ -3605,6 +3605,10 @@ mime@^1.3.4, mime@~1.3.4, mime@1.3.4:
|
||||
version "1.3.4"
|
||||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.3.4.tgz#115f9e3b6b3daf2959983cb38f149a2d40eb5d53"
|
||||
|
||||
mime@1.2.x:
|
||||
version "1.2.11"
|
||||
resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10"
|
||||
|
||||
min-document@^2.19.0:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
|
||||
@ -5062,7 +5066,7 @@ strip-json-comments@~1.0.1, strip-json-comments@~1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-1.0.4.tgz#1e15fbcac97d3ee99bf2d73b4c656b082bbafb91"
|
||||
|
||||
styled-components:
|
||||
styled-components@^1.1.3:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-1.1.3.tgz#9f5b19cff1b53e9063fdf82ccdf024dfd4d68d21"
|
||||
dependencies:
|
||||
@ -5333,6 +5337,13 @@ upper-case@^1.1.1:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598"
|
||||
|
||||
url-loader@^0.5.7:
|
||||
version "0.5.7"
|
||||
resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-0.5.7.tgz#67e8779759f8000da74994906680c943a9b0925d"
|
||||
dependencies:
|
||||
loader-utils "0.2.x"
|
||||
mime "1.2.x"
|
||||
|
||||
url-parse-lax@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/url-parse-lax/-/url-parse-lax-1.0.0.tgz#7af8f303645e9bd79a272e7a14ac68bc0609da73"
|
||||
|
Loading…
Reference in New Issue
Block a user