mirror of
https://github.com/strapi/strapi.git
synced 2025-11-08 06:07:41 +00:00
Add yarn dev to strapi-admin for dev workflow
This commit is contained in:
parent
0997ca0801
commit
ecde29fa8b
@ -1,2 +1,33 @@
|
|||||||
// empty plugins array for testing
|
const injectReducer = require('./utils/injectReducer').default;
|
||||||
export default {};
|
const injectSaga = require('./utils/injectSaga').default;
|
||||||
|
const { languages } = require('./i18n');
|
||||||
|
|
||||||
|
window.strapi = Object.assign(window.strapi || {}, {
|
||||||
|
node: MODE || 'host',
|
||||||
|
backendURL: BACKEND_URL === '/' ? window.location.origin : BACKEND_URL,
|
||||||
|
languages,
|
||||||
|
currentLanguage:
|
||||||
|
window.localStorage.getItem('strapi-admin-language') ||
|
||||||
|
window.navigator.language ||
|
||||||
|
window.navigator.userLanguage ||
|
||||||
|
'en',
|
||||||
|
injectReducer,
|
||||||
|
injectSaga,
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
'strapi-plugin-users-permissions': require('../../../strapi-plugin-users-permissions/admin/src')
|
||||||
|
.default,
|
||||||
|
'strapi-plugin-content-manager': require('../../../strapi-plugin-content-manager/admin/src')
|
||||||
|
.default,
|
||||||
|
'strapi-plugin-content-type-builder': require('../../../strapi-plugin-content-type-builder/admin/src')
|
||||||
|
.default,
|
||||||
|
'strapi-plugin-documentation': require('../../../strapi-plugin-documentation/admin/src')
|
||||||
|
.default,
|
||||||
|
'strapi-plugin-settings-manager': require('../../../strapi-plugin-settings-manager/admin/src')
|
||||||
|
.default,
|
||||||
|
'strapi-plugin-email': require('../../../strapi-plugin-email/admin/src')
|
||||||
|
.default,
|
||||||
|
'strapi-plugin-upload': require('../../../strapi-plugin-upload/admin/src')
|
||||||
|
.default,
|
||||||
|
};
|
||||||
|
|||||||
@ -151,4 +151,5 @@ async function build({ dir, env, options }) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
build,
|
build,
|
||||||
|
createPluginsJs,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -7,7 +7,8 @@
|
|||||||
"url": "git://github.com/strapi/strapi-admin.git"
|
"url": "git://github.com/strapi/strapi-admin.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"no tests yet\""
|
"test": "echo \"no tests yet\"",
|
||||||
|
"dev": "webpack-dev-server --config webpack.config.dev.js"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -98,5 +99,9 @@
|
|||||||
"npm": ">= 6.0.0"
|
"npm": ">= 6.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"gitHead": "c85658a19b8fef0f3164c19693a45db305dc07a9"
|
"gitHead": "c85658a19b8fef0f3164c19693a45db305dc07a9",
|
||||||
|
"devDependencies": {
|
||||||
|
"webpack-cli": "^3.3.2",
|
||||||
|
"webpack-dev-server": "^3.4.1"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
32
packages/strapi-admin/webpack.config.dev.js
Normal file
32
packages/strapi-admin/webpack.config.dev.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const webpackConfig = require('./webpack.config.js');
|
||||||
|
|
||||||
|
module.exports = () => {
|
||||||
|
const entry = path.join(__dirname, 'admin', 'src', 'app.js');
|
||||||
|
const dest = path.join(__dirname, 'build');
|
||||||
|
const env = 'development';
|
||||||
|
const options = {
|
||||||
|
backend: 'http://localhost:1337',
|
||||||
|
publicPath: '/admin/',
|
||||||
|
};
|
||||||
|
|
||||||
|
const args = {
|
||||||
|
entry,
|
||||||
|
dest,
|
||||||
|
env,
|
||||||
|
options,
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
...webpackConfig(args),
|
||||||
|
devServer: {
|
||||||
|
port: 4000,
|
||||||
|
clientLogLevel: 'none',
|
||||||
|
hot: true,
|
||||||
|
quiet: true,
|
||||||
|
historyApiFallback: {
|
||||||
|
index: '/admin/',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
@ -67,10 +67,10 @@ module.exports = ({
|
|||||||
publicPath: options.publicPath,
|
publicPath: options.publicPath,
|
||||||
// Utilize long-term caching by adding content hashes (not compilation hashes)
|
// Utilize long-term caching by adding content hashes (not compilation hashes)
|
||||||
// to compiled assets for production
|
// to compiled assets for production
|
||||||
filename: isProduction ? '[name].js' : '[name].[chunkhash].js',
|
filename: isProduction ? '[name].[contenthash:8].js' : 'bundle.js',
|
||||||
chunkFilename: isProduction
|
chunkFilename: isProduction
|
||||||
? '[name].chunk.js'
|
? '[name].[contenthash:8].chunk.js'
|
||||||
: '[name].[chunkhash].chunk.js',
|
: '[name].chunk.js',
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
minimize: isProduction,
|
minimize: isProduction,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user