Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5208332

Browse files
authored
Update from sfc template (#124)
* Revert package update from 527e734 * Update from sfc template --------- Co-authored-by: janniks <janniks@users.noreply.github.com>
1 parent b96cf12 commit 5208332

File tree

8 files changed

+12890
-27706
lines changed

8 files changed

+12890
-27706
lines changed

‎babel.config.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
const devPresets = ['@vue/babel-preset-app'];
2-
const buildPresets = ['@babel/preset-env'];
1+
const devPresets = ["@vue/babel-preset-app"];
2+
const buildPresets = [
3+
[
4+
"@babel/preset-env",
5+
// Config for @babel/preset-env
6+
{
7+
// Example: Always transpile optional chaining/nullish coalescing
8+
// include: [
9+
// /(optional-chaining|nullish-coalescing)/
10+
// ],
11+
},
12+
],
13+
];
314
module.exports = {
4-
presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets),
15+
presets: process.env.NODE_ENV === "development" ? devPresets : buildPresets,
516
};

‎build/rollup.config.js

Lines changed: 31 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ import path from "path";
44
import vue from "rollup-plugin-vue";
55
import alias from "@rollup/plugin-alias";
66
import commonjs from "@rollup/plugin-commonjs";
7+
import resolve from "@rollup/plugin-node-resolve";
78
import replace from "@rollup/plugin-replace";
8-
import babel from "rollup-plugin-babel";
9-
import postcss from "rollup-plugin-postcss";
9+
import babel from "@rollup/plugin-babel";
1010
import { terser } from "rollup-plugin-terser";
11-
import postcssLogical from "postcss-logical";
1211
import minimist from "minimist";
1312

1413
// Get browserslist config and remove ie from es build targets
@@ -18,6 +17,11 @@ const esbrowserslist = fs
1817
.split("\n")
1918
.filter((entry) => entry && entry.substring(0, 2) !== "ie");
2019

20+
// Extract babel preset-env config, to combine with esbrowserslist
21+
const babelPresetEnvConfig = require("../babel.config").presets.filter(
22+
(entry) => entry[0] === "@babel/preset-env"
23+
)[0][1];
24+
2125
const argv = minimist(process.argv.slice(2));
2226

2327
const projectRoot = path.resolve(__dirname, "..");
@@ -27,25 +31,35 @@ const baseConfig = {
2731
plugins: {
2832
preVue: [
2933
alias({
30-
resolve: [".js", ".jsx", ".ts", ".tsx", ".vue"],
31-
entries: {
32-
"@": path.resolve(projectRoot, "src"),
33-
},
34+
entries: [
35+
{
36+
find: "@",
37+
replacement: `${path.resolve(projectRoot, "src")}`,
38+
},
39+
],
3440
}),
3541
],
3642
replace: {
43+
preventAssignment: true,
3744
"process.env.NODE_ENV": JSON.stringify("production"),
38-
"process.env.ES_BUILD": JSON.stringify("false"),
45+
"process.env.ES_BUILD": JSON.stringify("true"),
3946
},
4047
vue: {
4148
css: true,
4249
template: {
4350
isProduction: true,
4451
},
4552
},
53+
postVue: [
54+
resolve({
55+
extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"],
56+
}),
57+
commonjs(),
58+
],
4659
babel: {
4760
exclude: "node_modules/**",
4861
extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"],
62+
babelHelpers: "bundled",
4963
},
5064
},
5165
};
@@ -74,28 +88,26 @@ if (!argv.format || argv.format === "es") {
7488
external,
7589
output: {
7690
file: "dist/esm.js",
77-
format: "es",
91+
format: "esm",
7892
exports: "named",
7993
},
8094
plugins: [
81-
replace({
82-
...baseConfig.plugins.replace,
83-
"process.env.ES_BUILD": JSON.stringify("true"),
84-
}),
95+
replace(baseConfig.plugins.replace),
8596
...baseConfig.plugins.preVue,
8697
vue(baseConfig.plugins.vue),
98+
...baseConfig.plugins.postVue,
8799
babel({
88100
...baseConfig.plugins.babel,
89101
presets: [
90102
[
91103
"@babel/preset-env",
92104
{
105+
...babelPresetEnvConfig,
93106
targets: esbrowserslist,
94107
},
95108
],
96109
],
97110
}),
98-
commonjs(),
99111
],
100112
};
101113
buildFormats.push(esConfig);
@@ -110,7 +122,7 @@ if (!argv.format || argv.format === "cjs") {
110122
file: "dist/ssr.js",
111123
format: "cjs",
112124
name: "VueNotion",
113-
exports: "named",
125+
exports: "auto",
114126
globals,
115127
},
116128
plugins: [
@@ -123,8 +135,8 @@ if (!argv.format || argv.format === "cjs") {
123135
optimizeSSR: true,
124136
},
125137
}),
138+
...baseConfig.plugins.postVue,
126139
babel(baseConfig.plugins.babel),
127-
commonjs(),
128140
],
129141
};
130142
buildFormats.push(umdConfig);
@@ -138,16 +150,16 @@ if (!argv.format || argv.format === "iife") {
138150
compact: true,
139151
file: "dist/min.js",
140152
format: "iife",
141-
name: "VueNotion",
153+
name: "VuteNotion",
142154
exports: "named",
143155
globals,
144156
},
145157
plugins: [
146158
replace(baseConfig.plugins.replace),
147159
...baseConfig.plugins.preVue,
148160
vue(baseConfig.plugins.vue),
161+
...baseConfig.plugins.postVue,
149162
babel(baseConfig.plugins.babel),
150-
commonjs(),
151163
terser({
152164
output: {
153165
ecma: 5,
@@ -158,28 +170,5 @@ if (!argv.format || argv.format === "iife") {
158170
buildFormats.push(unpkgConfig);
159171
}
160172

161-
if (!argv.format || argv.format === "postcss") {
162-
const postCssConfig = {
163-
input: "build/postcss.js",
164-
output: {
165-
format: "es",
166-
file: "dist/styles.ignore",
167-
},
168-
plugins: [
169-
postcss({
170-
extract: true,
171-
minimize: true,
172-
plugins: [postcssLogical()],
173-
}),
174-
],
175-
};
176-
buildFormats.push(postCssConfig);
177-
}
178-
179173
// Export config
180-
export default (commandLineArgs) => {
181-
// Exporting a method enables command line args override
182-
// https://rollupjs.org/guide/en/#configuration-files
183-
delete commandLineArgs.format;
184-
return buildFormats;
185-
};
174+
export default buildFormats;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /