'package.json参数更改'

This commit is contained in:
yumingqian 2021-08-03 11:30:39 +08:00
parent e39fbc0863
commit f7daf7a784
6 changed files with 23 additions and 147 deletions

View File

@ -11,7 +11,7 @@
<body>
<div id="root"></div>
<script type="module" src="../src/index.tsx"></script>
<!-- <o-time-picker id="timepicker" size="medium" noCalendar="false" ></o-time-picker> -->
<o-time-picker size="medium" nocalendar=false ></o-time-picker>
</body>

View File

@ -11,7 +11,7 @@
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
<!-- <o-time-picker id="timepicker" size="medium" noCalendar="false" ></o-time-picker> -->
<!-- <o-time-picker id="timepicker" size="medium" no-calendar="false" ></o-time-picker> -->
</body>

View File

@ -1,5 +1,15 @@
{
"version": "0.0.0",
"name": "@omiu/time-picker",
"version": "0.0.1",
"main": "dist/index.es.js",
"exports": {
".": "./dist/index.es.js"
},
"types": "types/index.d.ts",
"files": [
"dist",
"types"
],
"scripts": {
"start": "vite",
"build": "tsc && vite build --base=./",

View File

@ -1,38 +0,0 @@
import nodeResolve from "rollup-plugin-node-resolve";
import typescript from 'rollup-plugin-typescript';
import scss from 'rollup-plugin-scss'
import commonjs from '@rollup/plugin-commonjs';
const fs = require('fs')
const license = require("rollup-plugin-license");
const pkg = require("../package.json");
const licensePlugin = license({
banner: `${pkg.name} v${pkg.version} http://omijs.org\r\nFront End Cross-Frameworks Framework.\r\nBy dntzhang https://github.com/dntzhang \r\n Github: https://github.com/Tencent/omi\r\n MIT Licensed.`
});
export default {
input: "src/index.tsx",
output: {
format: "es",
file: "./src/index.esm.js",
name: pkg.name,
sourcemap: true,
strict: true
},
plugins: [
nodeResolve({
main: true
}),
scss({
//output: false,
output: function (styles, styleNodes) {
fs.writeFileSync('./src/index.css', styles)
},
}),
typescript(),
commonjs(),
licensePlugin
],
//external: ['omi','../../icon/esm/date-range']
};

View File

@ -1,102 +0,0 @@
const path = require('path')
const glob = require('glob')
const webpack = require('webpack')
const ProgressBarPlugin = require('progress-bar-webpack-plugin')
const pkgName = require('../package.json')
const componentName = pkgName.name.split('/')[1]
const name = 'o-' + componentName
const library = 'O' + componentName.split('-').map(name => name.charAt(0).toUpperCase() + name.slice(1)).join('')
const config = {
devtool: 'source-map',
plugins: [
new ProgressBarPlugin()
],
entry: {
[name]: './src/index.tsx'
},
output: {
path: path.resolve(__dirname, '../src/'),
filename: 'index.js',
libraryTarget: 'umd',
library: library,
libraryExport: "default",
globalObject: 'this'
},
mode: 'development',
module: {
rules: [{
test: /\.scss$/,
use: [
'to-string-loader',
'css-loader',
{
loader: 'resolve-url-loader'
},
{
loader: 'sass-loader',
options: {
sourceMap: true,
// mdc-web doesn't use sass-loader's normal syntax for imports
// across modules, so we add all module directories containing
// mdc-web components to the Sass include path
// https://github.com/material-components/material-components-web/issues/351
includePaths: glob.sync(path.join(__dirname, '../node_modules/@material')).map((dir) => path.dirname(dir))
}
}
]
},
{
test: /\.css$/,
use: [
'to-string-loader',
'css-loader',
{
loader: 'resolve-url-loader'
}
]
},
{
test: /\.less$/,
use: [
'style-loader',
'css-loader',
{
loader: 'resolve-url-loader'
},
'less-loader'
]
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: "url-loader"
},
{
test: /\.[t|j]sx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
watch: process.argv[3] === 'demo',
externals: {
'omi': {
commonjs: "omi",
commonjs2: "omi",
amd: "omi",
root: "Omi"
}
}
}
webpack(config, (err, stats) => { // Stats Object
if (err || stats.hasErrors()) {
// Handle errors here
}
// Done processing
})

View File

@ -1,20 +1,26 @@
import { resolve } from "path";
import path from 'path';
console.log(resolve(__dirname, "/index.html"))
//console.log(resolve(__dirname, "/index.html"))
export default {
esbuild: {
jsxFactory: "h",
jsxFragment: "Fragment"
},
lib: {
entry: path.resolve(__dirname, 'src/index.tsx'),
name: 'index',
formats: ['es'],
fileName: (format) => `index.${format}.js`
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, "demos/index.html"),
// main:"/demos/index.html"
main: resolve(__dirname, "index.html"),
//admin: resolve(__dirname, "admin.html")
},
// external:['omi'],
external:/^omi/,
// output: {
// name: 'core',
// dir: 'dist/lib/core.js',