Skip to content

Commit

Permalink
style: lint rule changed
Browse files Browse the repository at this point in the history
  • Loading branch information
sendya committed Apr 6, 2022
1 parent fe8313e commit 0c6f292
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions packages/shared/plugin-less-copy/rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// import { fileURLToPath, URL } from 'url'

import resolve from '@rollup/plugin-node-resolve'
import typescript from '@rollup/plugin-typescript'
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import commonjs from '@rollup/plugin-commonjs';

import pkg from './package.json'
import pkg from './package.json';

export default {
input: 'src/index.ts',
Expand All @@ -21,4 +21,4 @@ export default {
sourceMap: false,
}),
],
}
};
26 changes: 13 additions & 13 deletions packages/shared/plugin-less-copy/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { resolve } from 'path'
import { normalizePath, type Plugin } from 'vite'
import { resolve } from 'path';
import { normalizePath, type Plugin } from 'vite';

const excludeRegx = /node_modules/
const excludeRegx = /node_modules/;

function createPlugin(): Plugin {
const maps = new Map<string, string>()
const srcDir = normalizePath(resolve('./src/'))
const maps = new Map<string, string>();
const srcDir = normalizePath(resolve('./src/'));

return {
name: 'vite-plugin-less-copy',
enforce: 'pre',
apply: 'build',
transform(code: string, id: string) {
if (!id.endsWith('.less') || excludeRegx.test(id)) {
return
return;
}

maps.set(id, code)
return code
maps.set(id, code);
return code;
},

generateBundle() {
maps.forEach((code, file) => {
const filename = file.replace(srcDir, '').substring(1)
const filename = file.replace(srcDir, '').substring(1);
this.emitFile({
type: 'asset',
fileName: filename,
source: code,
})
})
});
});
},
}
};
}

export default createPlugin
export default createPlugin;

0 comments on commit 0c6f292

Please sign in to comment.