mirror of
https://github.com/strapi/strapi.git
synced 2025-12-28 07:33:17 +00:00
Fix run setup
This commit is contained in:
parent
3ccef3e3ba
commit
47f75f601b
@ -44,4 +44,4 @@
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -16,7 +16,7 @@ const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
|
||||
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
|
||||
// Load plugins into the same build in development mode.
|
||||
const plugins = {
|
||||
@ -111,13 +111,27 @@ module.exports = require('./webpack.base.babel')({
|
||||
],
|
||||
alias: {
|
||||
moment: 'moment/moment.js',
|
||||
'lodash': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
'lodash': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
},
|
||||
|
||||
// Emit a source map for easier debugging
|
||||
|
||||
@ -13,6 +13,7 @@ const webpack = require('webpack');
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
|
||||
module.exports = {
|
||||
context: appPath,
|
||||
@ -22,7 +23,9 @@ module.exports = {
|
||||
devtool: 'cheap-module-source-map',
|
||||
output: {
|
||||
filename: '[name].dll.js',
|
||||
path: path.join(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'dist'),
|
||||
path: isSetup ?
|
||||
path.join(__dirname, 'dist'):
|
||||
path.join(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'dist'),
|
||||
|
||||
// The name of the global variable which the library's
|
||||
// require() function will be assigned to
|
||||
@ -31,7 +34,9 @@ module.exports = {
|
||||
plugins: [
|
||||
new webpack.DllPlugin({
|
||||
name: '[name]_lib',
|
||||
path: path.join(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'manifest.json'),
|
||||
path: isSetup ?
|
||||
path.join(__dirname, 'manifest.json'):
|
||||
path.join(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'manifest.json'),
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
@ -43,13 +48,27 @@ module.exports = {
|
||||
],
|
||||
alias: {
|
||||
moment: 'moment/moment.js',
|
||||
'lodash': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
'lodash': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
},
|
||||
symlinks: false,
|
||||
extensions: [
|
||||
|
||||
@ -31,7 +31,10 @@ const pluginsToInitialize = (() => {
|
||||
|
||||
const plugins = [
|
||||
new webpack.DllReferencePlugin({
|
||||
manifest: require(path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'manifest.json')),
|
||||
manifest: require(isSetup ?
|
||||
path.join(__dirname, 'manifest.json'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'lib', 'internals', 'webpack', 'manifest.json')
|
||||
),
|
||||
}),
|
||||
// Minify and optimize the JavaScript
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
@ -100,9 +103,15 @@ if (isAdmin) {
|
||||
}));
|
||||
}
|
||||
|
||||
const main = isAdmin
|
||||
? path.join(appPath, 'admin', 'admin', 'src', 'app.js')
|
||||
: path.join(process.env.PWD, 'node_modules', 'strapi-helper-plugin', 'lib', 'src', 'app.js');
|
||||
const main = (() => {
|
||||
if (isAdmin && isSetup) {
|
||||
return path.join(process.cwd(), 'admin', 'src', 'app.js');
|
||||
} else if (isAdmin) {
|
||||
return path.join(appPath, 'admin', 'admin', 'src', 'app.js');
|
||||
}
|
||||
|
||||
return path.join(process.env.PWD, 'node_modules', 'strapi-helper-plugin', 'lib', 'src', 'app.js');
|
||||
})();
|
||||
|
||||
module.exports = require('./webpack.base.babel')({
|
||||
// In production, we skip all hot-reloading stuff
|
||||
@ -146,13 +155,27 @@ module.exports = require('./webpack.base.babel')({
|
||||
|
||||
alias: {
|
||||
moment: 'moment/moment.js',
|
||||
'lodash': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
'lodash': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'lodash'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'lodash'),
|
||||
'immutable': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'immutable'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'immutable'),
|
||||
'react-intl': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-intl'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-intl'),
|
||||
'react': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react'),
|
||||
'react-dom': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-dom'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-dom'),
|
||||
'react-transition-group': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'react-transition-group'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'react-transition-group'),
|
||||
'reactstrap': isSetup ?
|
||||
path.resolve(__dirname, '..', '..', '..', 'node_modules', 'reactstrap'):
|
||||
path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin', 'node_modules', 'reactstrap')
|
||||
},
|
||||
|
||||
devtool: 'cheap-module-source-map',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user