From 5b9668d0502729d25f081f5dfd9b35c7cadf3136 Mon Sep 17 00:00:00 2001 From: Rotem Ben-Itzhak Date: Mon, 23 Aug 2021 02:37:07 +0300 Subject: [PATCH] feat(re-styled,styles): testing --- .../src/components/heading/styled-heading.js | 3 -- packages/styles/package.json | 19 ++++++++ packages/styles/webpack.config.js | 48 +++++++++++++++++++ 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 packages/styles/webpack.config.js diff --git a/packages/re-styled/src/components/heading/styled-heading.js b/packages/re-styled/src/components/heading/styled-heading.js index d44aaf5..380d8e1 100644 --- a/packages/re-styled/src/components/heading/styled-heading.js +++ b/packages/re-styled/src/components/heading/styled-heading.js @@ -1,8 +1,5 @@ import styled from 'styled-components'; import { getVariant } from 'utils'; -import { tints } from '@elementor/styles'; - -window.console.log( '*** Rot', tints ); const Heading = styled.h1` ${ ( props ) => getVariant( props.variant, {} ) } diff --git a/packages/styles/package.json b/packages/styles/package.json index fa57e29..b324e51 100644 --- a/packages/styles/package.json +++ b/packages/styles/package.json @@ -25,5 +25,24 @@ }, "scripts": { "test": "echo \"Error: run tests from root\" && exit 1" + }, + "devDependencies": { + "@babel/core": "^7.2.2", + "@babel/preset-env": "^7.3.1", + "@babel/preset-react": "^7.0.0", + "@elementor/styles": "^0.29.0", + "babel-loader": "^8.0.5", + "prop-types": "^15.7.2", + "react": "^16.7.0", + "react-dom": "^16.7.0", + "styled-components": "^5.3.0", + "webpack": "^4.29.0", + "webpack-cli": "^3.2.1" + }, + "peerDependencies": { + "prop-types": ">=15.7.2", + "react": ">=16.7.0", + "react-dom": ">=16.7.0", + "styled-components": ">=5.3.0" } } diff --git a/packages/styles/webpack.config.js b/packages/styles/webpack.config.js new file mode 100644 index 0000000..c22648f --- /dev/null +++ b/packages/styles/webpack.config.js @@ -0,0 +1,48 @@ +const webpack = require( 'webpack' ); +const path = require( 'path' ); + +module.exports = { + mode: 'production', + entry: './src/index.js', + resolve: { + alias: {}, + }, + output: { + filename: 'index.js', + library: '@elementor/styles', + libraryTarget: 'umd', + path: path.resolve( __dirname, 'lib' ), + umdNamedDefine: true + }, + module: { + rules: [ + { + test: /\.(js|jsx)$/, + exclude: /node_modules/, + use: [ + { + loader: 'babel-loader', + options: { + presets: [ [ '@babel/preset-env', { "useBuiltIns": "usage", "corejs": 3 } ], '@babel/preset-react' ], + }, + }, + ], + }, + ], + }, + externals: { + // Don't bundle react or react-dom + react: { + commonjs: "react", + commonjs2: "react", + amd: "React", + root: "React" + }, + "react-dom": { + commonjs: "react-dom", + commonjs2: "react-dom", + amd: "ReactDOM", + root: "ReactDOM" + } + } +};