浏览代码

:zap: use cdn

Van 6 年之前
父节点
当前提交
9e104efb2a
共有 3 个文件被更改,包括 11 次插入11 次删除
  1. 2 2
      demo/demo.js
  2. 1 1
      package.json
  3. 8 8
      webpack.config.js

+ 2 - 2
demo/demo.js

@@ -1,5 +1,5 @@
-import Vditor from '../src/index'
-// import Vditor from '../dist/vditor/index.min'
+// import Vditor from '../src/index'
+import Vditor from '../dist/index.min'
 
 const vditor = new Vditor('vditor', {
   cache: false,

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "vditor",
-  "version": "0.1.2",
+  "version": "0.1.3",
   "description": "A markdown editor written in TypeScript",
   "author": " Vanessa <[email protected]> (http://vanessa.b3log.org)",
   "homepage": "https://hacpai.com/cr",

+ 8 - 8
webpack.config.js

@@ -48,9 +48,9 @@ module.exports = [
     mode: 'production',
     output: {
       filename: '[name].js',
-      path: path.resolve(__dirname, 'dist/vditor'),
+      path: path.resolve(__dirname, 'dist'),
       chunkFilename: '[name].bundle.js',
-      publicPath: '/dist/vditor/',
+      publicPath: `https://vditor.b3log.org/${pkg.version}/`,
       libraryTarget: 'umd',
       library: 'Vditor',
       libraryExport: 'default',
@@ -115,8 +115,8 @@ module.exports = [
       ],
     },
     plugins: [
-      new BundleAnalyzerPlugin(),
-      new CleanWebpackPlugin(['./dist/vditor']),
+      // new BundleAnalyzerPlugin(),
+      new CleanWebpackPlugin(['./dist']),
       new webpack.DefinePlugin({
         VDITOR_VERSION: JSON.stringify(pkg.version),
       }),
@@ -125,8 +125,8 @@ module.exports = [
   }, {
     mode: 'production',
     entry: {
-      'vditor/index.classic': './src/assets/scss/classic.scss',
-      'vditor/index.dark': './src/assets/scss/dark.scss',
+      'index.classic': './src/assets/scss/classic.scss',
+      'index.dark': './src/assets/scss/dark.scss',
     },
     resolve: {
       extensions: ['.scss'],
@@ -171,8 +171,8 @@ module.exports = [
         filename: '[name].css',
       }),
       new WebpackOnBuildPlugin(() => {
-        fs.unlinkSync('./dist/vditor/index.classic.js')
-        fs.unlinkSync('./dist/vditor/index.dark.js')
+        fs.unlinkSync('./dist/index.classic.js')
+        fs.unlinkSync('./dist/index.dark.js')
       }),
     ],
   }]