Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump glob-parent and nuxt in /example #125

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
current node
node 12
last 2 versions and > 2%
ie > 10
6 changes: 3 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const devPresets = ['@vue/babel-preset-app'];
const buildPresets = ['@babel/preset-env'];
const devPresets = ["@vue/babel-preset-app"];
const buildPresets = [["@babel/preset-env"]];
module.exports = {
presets: (process.env.NODE_ENV === 'development' ? devPresets : buildPresets),
presets: process.env.NODE_ENV === "development" ? devPresets : buildPresets,
};
83 changes: 26 additions & 57 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ import path from "path";
import vue from "rollup-plugin-vue";
import alias from "@rollup/plugin-alias";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import replace from "@rollup/plugin-replace";
import babel from "rollup-plugin-babel";
import postcss from "rollup-plugin-postcss";
import babel from "@rollup/plugin-babel";
import { terser } from "rollup-plugin-terser";
import postcssLogical from "postcss-logical";
import minimist from "minimist";

// Get browserslist config and remove ie from es build targets
const esbrowserslist = fs
.readFileSync("./.browserslistrc")
.toString()
.split("\n")
.filter((entry) => entry && entry.substring(0, 2) !== "ie");

const argv = minimist(process.argv.slice(2));

const projectRoot = path.resolve(__dirname, "..");
Expand All @@ -27,25 +19,35 @@ const baseConfig = {
plugins: {
preVue: [
alias({
resolve: [".js", ".jsx", ".ts", ".tsx", ".vue"],
entries: {
"@": path.resolve(projectRoot, "src"),
},
entries: [
{
find: "@",
replacement: `${path.resolve(projectRoot, "src")}`,
},
],
}),
],
replace: {
preventAssignment: true,
"process.env.NODE_ENV": JSON.stringify("production"),
"process.env.ES_BUILD": JSON.stringify("false"),
"process.env.ES_BUILD": JSON.stringify("true"),
},
vue: {
css: true,
template: {
isProduction: true,
},
},
postVue: [
resolve({
extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"],
}),
commonjs(),
],
babel: {
exclude: "node_modules/**",
extensions: [".js", ".jsx", ".ts", ".tsx", ".vue"],
babelHelpers: "bundled",
},
},
};
Expand Down Expand Up @@ -74,28 +76,18 @@ if (!argv.format || argv.format === "es") {
external,
output: {
file: "dist/esm.js",
format: "es",
format: "esm",
exports: "named",
},
plugins: [
replace({
...baseConfig.plugins.replace,
"process.env.ES_BUILD": JSON.stringify("true"),
}),
replace(baseConfig.plugins.replace),
...baseConfig.plugins.preVue,
vue(baseConfig.plugins.vue),
...baseConfig.plugins.postVue,
babel({
...baseConfig.plugins.babel,
presets: [
[
"@babel/preset-env",
{
targets: esbrowserslist,
},
],
],
presets: ["@babel/preset-env"],
}),
commonjs(),
],
};
buildFormats.push(esConfig);
Expand All @@ -110,7 +102,7 @@ if (!argv.format || argv.format === "cjs") {
file: "dist/ssr.js",
format: "cjs",
name: "VueNotion",
exports: "named",
exports: "auto",
globals,
},
plugins: [
Expand All @@ -123,8 +115,8 @@ if (!argv.format || argv.format === "cjs") {
optimizeSSR: true,
},
}),
...baseConfig.plugins.postVue,
babel(baseConfig.plugins.babel),
commonjs(),
],
};
buildFormats.push(umdConfig);
Expand All @@ -138,16 +130,16 @@ if (!argv.format || argv.format === "iife") {
compact: true,
file: "dist/min.js",
format: "iife",
name: "VueNotion",
name: "VuteNotion",
exports: "named",
globals,
},
plugins: [
replace(baseConfig.plugins.replace),
...baseConfig.plugins.preVue,
vue(baseConfig.plugins.vue),
...baseConfig.plugins.postVue,
babel(baseConfig.plugins.babel),
commonjs(),
terser({
output: {
ecma: 5,
Expand All @@ -158,28 +150,5 @@ if (!argv.format || argv.format === "iife") {
buildFormats.push(unpkgConfig);
}

if (!argv.format || argv.format === "postcss") {
const postCssConfig = {
input: "build/postcss.js",
output: {
format: "es",
file: "dist/styles.ignore",
},
plugins: [
postcss({
extract: true,
minimize: true,
plugins: [postcssLogical()],
}),
],
};
buildFormats.push(postCssConfig);
}

// Export config
export default (commandLineArgs) => {
// Exporting a method enables command line args override
// https://rollupjs.org/guide/en/#configuration-files
delete commandLineArgs.format;
return buildFormats;
};
export default buildFormats;
Loading