fix: build script
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
.idea
|
||||
example-project
|
||||
docs
|
||||
docs
|
||||
src/public/js
|
||||
@@ -15,9 +15,9 @@
|
||||
"server-dev": "nodemon src/index.dev.js",
|
||||
"server-debug": "nodemon --inspect src/index.dev.js",
|
||||
"clean": "rm -rf src/public/dist/standalone-build",
|
||||
"babel-compile": "babel src/public/js -d src/public/dist/standalone-build --config-file ./src/public/babel.config.js --copy-files",
|
||||
"build": "yarn clean && node scripts/index.js && yarn babel-compile && yarn client-dev",
|
||||
"start:standalone": "cd src/public/dist/standalone && http-server",
|
||||
"babel-compile-standalone": "babel src/public/js -d src/public/dist/standalone-build --config-file ./src/public/babel.config.js --copy-files",
|
||||
"webpack-compile-local": "cd src/public && webpack --config webpack.local.js --progress",
|
||||
"build": "yarn clean && yarn babel-compile-standalone && yarn webpack-compile-local",
|
||||
"pretty": "prettier --write \"./src/public/js/**/*.js\""
|
||||
},
|
||||
"bin": {
|
||||
@@ -57,12 +57,14 @@
|
||||
"@babel/cli": "^7.4.4",
|
||||
"@babel/core": "^7.1.2",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||
"@babel/plugin-transform-runtime": "^7.4.4",
|
||||
"@babel/preset-env": "^7.1.0",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@commitlint/cli": "^7.3.2",
|
||||
"@commitlint/config-conventional": "^7.3.1",
|
||||
"babel-loader": "^8.0.4",
|
||||
"babel-plugin-import": "^1.9.1",
|
||||
"babel-plugin-transform-define": "^1.3.1",
|
||||
"css-loader": "^0.28.11",
|
||||
"husky": "^1.3.1",
|
||||
"node-sass": "^4.9.3",
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const { version } = require('../package.json');
|
||||
|
||||
const metaInfo = `export default { version: '${version}' }`;
|
||||
|
||||
const writeMetaInfo = path =>
|
||||
fs.writeFile(path, metaInfo, err => {
|
||||
if (err) console.log(err);
|
||||
});
|
||||
|
||||
writeMetaInfo('src/public/js/meta.js');
|
||||
@@ -1,19 +1,31 @@
|
||||
const packageJson = require('../../package');
|
||||
|
||||
module.exports = function(app) {
|
||||
app.cache(true);
|
||||
|
||||
const presets = [
|
||||
'@babel/preset-react',
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
useBuiltIns: 'usage'
|
||||
targets: {
|
||||
browsers: ['last 2 versions']
|
||||
},
|
||||
modules: false
|
||||
}
|
||||
]
|
||||
],
|
||||
'@babel/preset-react'
|
||||
];
|
||||
|
||||
const plugins = [
|
||||
['import', { libraryName: 'antd', libraryDirectory: 'es', style: 'css' }],
|
||||
'@babel/plugin-syntax-dynamic-import'
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-transform-runtime',
|
||||
[
|
||||
'transform-define',
|
||||
{
|
||||
'process.env.CODECRUMBS_VERSION': packageJson.version
|
||||
}
|
||||
]
|
||||
];
|
||||
|
||||
return {
|
||||
|
||||
@@ -1 +1 @@
|
||||
export default { version: '1.5.6' }
|
||||
export default { version: process.env.CODECRUMBS_VERSION }
|
||||
@@ -29,7 +29,7 @@ module.exports = {
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
include: /node_modules/,
|
||||
include: [path.resolve(__dirname, '../../node_modules/antd/')],
|
||||
use: ['style-loader', 'css-loader']
|
||||
}
|
||||
]
|
||||
|
||||
13
src/public/webpack.local.js
Normal file
13
src/public/webpack.local.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const webpack = require('webpack');
|
||||
const merge = require('webpack-merge');
|
||||
|
||||
const common = require('./webpack.common.js');
|
||||
|
||||
module.exports = merge(common, {
|
||||
mode: 'production',
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.LOCAL': JSON.stringify(true)
|
||||
})
|
||||
]
|
||||
});
|
||||
Reference in New Issue
Block a user